How to Create a Tuple in Python
A tuple groups a fixed set of values, such as the x and y of a point, into one value. Unlike a list, it can't be changed after it's made, which makes it a safe way to pass such a group around. This guide creates a point, with real output from Python 3.15.2.
Syntax
<name> = (<value 1>, <value 2>, ...)
<name> = (<value>,) # a tuple with one item needs the comma
| Part | What it means |
|---|---|
( ... ) | The parentheses group the values; the commas are what make the tuple |
<value>, ... | Any values, of any types, in a fixed order |
The Python tutorial: "A tuple consists of a number of values separated by commas".
Prerequisites
- uv and Python 3. This guide uses uv 0.13.10 with Python 3.15.2, in a project made with
uv init.
Step 1: Write the Script
point = (3, 4)
print(point)
print(point[0])
print(len(point))
![The point.py script in a macOS-style code window: point = (3, 4), then print(point), print(point[0]) and print(len(point)).](https://strdewiridedevblogsprod.blob.core.windows.net/images/blog/programming/python/2026/python-tuple-01-code.webp)
Step 2: Run It
uv run python point.py
(3, 4)
3
2

The tuple prints in parentheses. Its items are read by position like a list's, and len counts them.
Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
| A one-item tuple without the comma | (5) is just the number 5: type((5)) was <class 'int'> | Add the comma: type((5,)) was <class 'tuple'> |
| Trying to change an item | point[0] = 10 raised TypeError: 'tuple' object does not support item assignment | Make a new tuple, or use a list if the values must change |
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
TypeError: 'tuple' object does not support item assignment | Tuples can't be changed after they're made | Build a new tuple, such as (10, point[1]) |
FAQ
When should I use a tuple instead of a list?
When the values belong together and shouldn't change, such as a point, a date's parts or a pair of settings. Use a list for a collection that grows or changes.
Why does one item need a comma?
The tutorial: "a tuple with one item is constructed by following a value with a comma (it is not sufficient to enclose a single value in parentheses)."
Conclusion
point = (3, 4) created a tuple: it printed as (3, 4), point[0] read 3, and len(point) counted 2. Remember the comma for one item, and that a tuple can't be changed.
Additional Resources
- Tuples and sequences — the tutorial's section.
- Tuples — the tuple type in the reference.
