Data structures & formats · reviewed in August 2026
Tuple
A tuple is an ordered, immutable collection of items in Python, written in parentheses, like (1, 2, 3). Once created it cannot be changed: you can't add, remove, or replace elements, unlike a list.
def divide(a, b):
return a // b, a % b
quotient, remainder = divide(17, 5)Frequently asked questions
Why use a tuple instead of a list?
When the set of values shouldn't change over the program's life (coordinates, a date) or when you need a dictionary key, since tuples — being immutable — can be hashable while lists cannot.
Can you unpack a tuple?
Yes: x, y = (3, 4) assigns 3 to x and 4 to y in a single line, a very common pattern for returning several values from a function.
Is a single-element tuple written as (value)?
No — that's just parentheses around a value. You need a trailing comma: (value,) is the correct form of a one-element tuple.