Lists hold many values and let you change them. What if you have a fixed group — a 2D point (3, 4), a date (2026, 5, 4) — that should never grow or shrink?
Python has a sibling collection: a tuple. Round brackets, comma-separated:
point = (3, 4)
print(point[0]) # 3
print(point[1]) # 4Indexing works the same as a list. The difference is what you can't do:
point[0] = 99 # TypeError: 'tuple' object does not support item assignmentWhy bother having two? Lists already work.
Two reasons. (1) Intent — (3, 4) signals "this is a 2D point, two values that belong together as one thing", whereas a list signals "a sequence that might grow." (2) Tuples can be used as dict keys; lists can't (because they could change underneath the dict).
Most beginner code uses lists. Tuples show up when a function returns multiple values, or when you want to lock a small bundle.
empty = ()
single = (5,) # comma required for 1-tuple
pair = (3, 4)
triple = ("Ada", 1815, "England")pair[0] # 3
pair[-1] # 4
len(pair) # 2pair[0] = 99 # TypeError
pair.append(5) # AttributeError — no append on tuplesTuples are immutable. Once created, the contents are locked.
A powerful tuple feature:
point = (3, 4)
x, y = point # x=3, y=4
print(x + y) # 7Unpacking also works on lists, but tuples are the natural shape for a fixed-size group.
def minmax(numbers):
return min(numbers), max(numbers)
low, high = minmax([4, 8, 15, 16, 23, 42])
print(low, high) # 4 42return min(numbers), max(numbers) returns a 2-tuple (4, 42). The caller unpacks it. This is the idiom for returning multiple values in Python.
| Use a list when | Use a tuple when |
|---|---|
| The collection grows / shrinks | The size is fixed |
| Order of elements is the meaning | Each position has a role (point: x then y) |
You'll mutate (append, [i]=...) | The bundle should not change |
Default to lists; reach for tuples when immutability or unpacking adds clarity.
Lists hold many values and let you change them. What if you have a fixed group — a 2D point (3, 4), a date (2026, 5, 4) — that should never grow or shrink?
Python has a sibling collection: a tuple. Round brackets, comma-separated:
point = (3, 4)
print(point[0]) # 3
print(point[1]) # 4Indexing works the same as a list. The difference is what you can't do:
point[0] = 99 # TypeError: 'tuple' object does not support item assignmentWhy bother having two? Lists already work.
Two reasons. (1) Intent — (3, 4) signals "this is a 2D point, two values that belong together as one thing", whereas a list signals "a sequence that might grow." (2) Tuples can be used as dict keys; lists can't (because they could change underneath the dict).
Most beginner code uses lists. Tuples show up when a function returns multiple values, or when you want to lock a small bundle.
empty = ()
single = (5,) # comma required for 1-tuple
pair = (3, 4)
triple = ("Ada", 1815, "England")pair[0] # 3
pair[-1] # 4
len(pair) # 2pair[0] = 99 # TypeError
pair.append(5) # AttributeError — no append on tuplesTuples are immutable. Once created, the contents are locked.
A powerful tuple feature:
point = (3, 4)
x, y = point # x=3, y=4
print(x + y) # 7Unpacking also works on lists, but tuples are the natural shape for a fixed-size group.
def minmax(numbers):
return min(numbers), max(numbers)
low, high = minmax([4, 8, 15, 16, 23, 42])
print(low, high) # 4 42return min(numbers), max(numbers) returns a 2-tuple (4, 42). The caller unpacks it. This is the idiom for returning multiple values in Python.
| Use a list when | Use a tuple when |
|---|---|
| The collection grows / shrinks | The size is fixed |
| Order of elements is the meaning | Each position has a role (point: x then y) |
You'll mutate (append, [i]=...) | The bundle should not change |
Default to lists; reach for tuples when immutability or unpacking adds clarity.
Create a free account to get started. Paid plans unlock all tracks.