What are sets?

Sets are collections of items, that, unlike lists, can’t have any duplicates in them. They are defined inside curly braces, e.g.:

female_names = {'Maria', 'Lucy', 'Angelina', 'Tanya'}
print (female_names)

{'Tanya', 'Lucy', 'Angelina', 'Maria'}

Notice what happens if we define a set with duplicate values:

female_names_2 = {'Angelina', 'Tanya', 'Maria', 'Lucy', 'Angelina', 'Tanya'}
print (female_names_2)

{'Maria', 'Lucy', 'Angelina', 'Tanya'}

Notice how only the unique values were printed.

Set items are unordered, meaning that they can appear in different order each time you use them. Also, set items are unchangeable, meaning that they cannot be changed once the set is created.
Geek University 2022