How to remove duplicates item from a list using Python
Python is very easy but you have to think just like python
def remove_dulicates(alist):
elist =[] #define an empty for new list without duplicate item
for i in alist:
if i not in elist:
elist.append(i)
return elist
print remove_dulicates([2,2,2,1,3,4,5])
output:[2, 1, 3, 4, 5]
Comments
Post a Comment