Sets
A set is an unordered collection of unique elements.
s = {1, 2, 3, 4, 5}\nt = {3, 4, 5, 6, 7}Properties
Set Operationss.add(6)\ns.remove(2)\ns.discard(10) # no error if missingMathematical OperationsOperationMethodSymbolUnions.union(t)s | tIntersections.intersection(t)s & tDifferences.difference(t)s - tSymmetric Diffs.symmetric_difference(t)s ^ tFrozensetfs = frozenset([1, 2, 3]) # immutable set