Glossary · Phase 0 · Tools
Symmetric difference
What's in exactly one of two sets, not both: a ^ b in Python.
Try it now
The right collection usually follows from one question: do you need order, names, or uniqueness?
Learn it properly
Sets: unique items and fast lookups · Duplicates, fast membership, set operations and comparing two lists. About 30 minutes.
Other terms from the same lesson
- frozenset: A set that can't be changed after it's made, so it can go inside another set or be a dictionary key.
- hashable: A value that can't change, such as a number, string or tuple, so it can go in a set or be a dictionary key.
- intersection: What two sets have in common: a & b in Python.
- set: A Python collection with no duplicates and no order, built for fast "is this in here?" checks.
- union: Everything that's in either of two sets: a | b in Python.
Never trained an AI?
Teach a small one to write, right in your browser. It takes about 20 seconds and needs no account.