BongoBinary

python language remove duplicates from list

By Aloyce Bahati1 year ago2 minutes read

In this post we are going to see the technique of removing duplicates from a python list. The simplest solution for removing duplicates in python list is to use the set technique(python set).

so we are creating a set by taking list values and passing them to a set constructor and taking back the set to list by applying the list constructor, The code snippet and youtube video bellow show more about the technique.

 

for more tips and trick about python programming language please subscribe and like.

#Remove duplicates from list python#

numbers = [1,2,2,3,4,5,5,1]

unique_numbers = list(set(numbers))

print(unique_numbers)