Tuples
A tuple looks like a list but with parentheses instead of square brackets, and behaves almost identically — except for one crucial difference: once created, a tuple can't be changed.
point = (3, 4) print(point) print(point[0]) x, y = point print(x, y)
(3, 4) 3 3 4
That last line — x, y = point — is called unpacking, and it's one of the most useful things about tuples: pulling multiple values out into separate variables in one line.
Why immutability matters
Trying to modify a tuple after creating it doesn't quietly fail — it raises a real error. This is genuinely the output you'd get running this:
point = (3, 4) point[0] = 10
Traceback (most recent call last):
File "script.py", line 2, in <module>
point[0] = 10
TypeError: 'tuple' object does not support item assignmentThat's usually exactly what you want when a value genuinely shouldn't change after it's created — coordinates, RGB colors, a function returning multiple fixed values. If you need to add, remove, or change items later, use a list instead.
Next: dictionaries — storing values by name instead of by position.
Practice exercise
Create point = (3, 4), unpack it into x and y, and print f"x={x}, y={y}".