pop()
a=[10, 20,30,40,50,30]
a. remove(30)
# If you need list without duplicate elements, code below
l = [10,20,30,40,50,30, 50]
print(list(set(l)))
# If you need duplicate from list, code below
seen = {}
dupes = []
for x in l:
if x not in seen:
seen[x] = 1
else:
if seen[x] == 1:
dupes.append(x)
print(dupes)
Comments
Leave a comment