Python Program to convert List to Set

bookmark

# Creating a list of ten data elements  
the_names = ["George", "Josh", "James", "Mark", "Carlo", "James", "Andy", "Sara", "Andy", "Victor"]  
  
# Converting the above list to the set  
the_unique_names = set( the_names)  
  
# Printing the set to the users  
print( the_unique_names)  


Output:

{'Victor', 'George', 'Josh', 'Andy', 'Mark', 'Carlo', 'Sara', 'James'}