§ 2.4.3section 9 of 18·~3 min
Sets
A set keeps only unique values. It's the quickest way to remove duplicates, or to check whether you've seen something before.
cities = ["Pune", "Delhi", "Pune", "Mumbai"]
unique = set(cities)
print(len(unique))
print("Delhi" in unique)
OUTPUT
3
TrueSets have no order, so you can't use an index like unique[0]. Checking x in some_set stays fast even with millions of values, which is why sets show up in dedup steps.