Tuples & Unpacking1 / 4
CRASH COURSE
Tuples & Unpacking
A tuple groups values in order and cannot be modified in place. Commas create the tuple; parentheses often make it clearer.
- Unpacking binds several names at once. The number of names must match the number of values unless a starred target gathers extras.
- Tuples are useful for fixed records such as coordinates. Immutability does not prevent a mutable object inside a tuple from changing.
point = (4, 7) x, y = point print(x + y)