Two key properties define sets: Uniqueness: Each element appears at most once. Adding a duplicate does nothing. python s = {1, 2, 3} s.add(2) # No effect - 2 is already there print(s) # {1, 2, 3}
Unordered: Elements have no position. You can't do s[0]. python s = {3, 1, 2} # print(s[0]) # TypeError: 'set' object is not subscriptable These properties make sets perfect for membership testing: "Is this item in my collection?"