Write a Python Program to Remove and print the Duplicate Items from a List


Topic: Write a Python Program to Remove and print the Duplicate Items from a List

Solution

a=[2, 3, 8, 9, 2, 4, 6]
b = set()
unique = []
for x in a:
    if x not in b:
        unique.append(x)
        b.add(x)
print("Non-duplicate items:")
print(unique)



List all Python Programs