Sets are collections of unique, unordered elements. They are like lists but do not allow duplicate values.
Properties of sets:
.png)
my_set = {1, 2, 3, "Tarif"}
print(my_set) # Output: {1, 2, 3, 'Tarif'}
If you try to add a duplicate value to a set, it will be ignored.
my_set = {1, 2, 3, 3, 3, 3, "Tarif",4, 4, 5, "Tarif"}
print(my_set)
**# Output: {1, 2, 3, 4, 'Tarif', 5}**
print(len(my_set))
**# Output: 6**
# Creating an empty set (use set() not {})
empty_set = set()
print(empty_set) # Output: set()