Study
Python · Sets
Sets for uniqueness and fast membership tests, plus union, intersection and difference.
- {} is an empty dict, not an empty set; use set().
- Membership tests on a set are O(1) on average, versus O(n) on a list.
Day page
Sets for uniqueness and fast membership tests, plus union, intersection and difference.