Python By Example

Python program to remove duplicate elements in a list

by Jiffin Joachim Gomez on 24th February 2017

This is a simple python script to remove duplicate elements in a list. The program uses a list with duplicate elements to show how we can remove duplicate elements. It's actually quite simple in Python, First convert the elements using set function this will produce a set of elements with unique elements and convert the set to List. It's that simple !!!

#A list with duplicate elements

print('The list before removing duplicate elements',a)
print('The list after removing duplicate elements',b)

Post a comment


Nothing the first to share wisdom.