Q:

Write a Python program to remove duplicates from a list

0

Write a Python program to remove duplicates from a list.

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

a = [10,20,30,20,10,50,60,40,80,50,40]

dup_items = set()
uniq_items = []
for x in a:
    if x not in dup_items:
        uniq_items.append(x)
        dup_items.add(x)

print(dup_items)

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now