Join our newsletter for the latest updates.

Python Program to Remove Duplicate Element From a List

In this example, you will learn to remove duplicate elements from a list.

To understand this example, you should have the knowledge of the following Python programming topics:

Example 1: Using set()

list_1 = [1, 2, 1, 4, 6]



[1, 2, 4, 6]

In the above example, we first convert the list into a set, then we again convert it into a list. Set cannot have a duplicate item in it, so set() removes keeps only an instance of the item.

Example 2: Remove the items that are duplicated

list_1 = [1, 2, 1, 4, 6]
list_2 = [7, 8, 2, 1]

print(list(set(list_1) - set(list_2) ))


[4, 6]

In the above example, the items that are present in both the lists are removed.