What Is a Tuple in Python?

A tuple in Python is a way to store multiple values in a single variable.

Tuples are ordered collections, which means the items stay in the same position. They are usually used for data that should not change after it is created.

You will often see tuples written with parentheses, like this:

numbers = (1, 2, 3)

If you want a deeper lesson, see Python tuples explained.

Simple definition

A tuple is a collection of values stored together.

Here are the main ideas:

  • A tuple is a collection of values in one variable
  • Tuple items keep their order
  • Tuples are usually used for data that should stay the same
  • Tuples are written with parentheses, like (1, 2, 3)

Example:

colors = ("red", "green", "blue")
print(colors)

Output:

('red', 'green', 'blue')

In this example, colors is a tuple with three items.

What makes a tuple different

A tuple has a few important features:

  • Tuples are ordered
  • Tuples can store different data types
  • Tuples are immutable, which means you cannot change individual items after creation
  • Tuples can contain duplicate values

Example:

data = ("Alice", 25, True, 25)
print(data)

Output:

('Alice', 25, True, 25)

This tuple contains:

  • a string
  • an integer
  • a boolean
  • a duplicate value

If you are new to immutability, see mutable vs immutable types in Python.

How to create a tuple

You create a tuple by separating values with commas.

Parentheses are common because they make the code easier to read.

Regular tuple

fruits = ("apple", "banana", "orange")
print(fruits)

Single-item tuple

A one-item tuple needs a trailing comma.

item = ("apple",)
print(item)
print(type(item))

Output:

('apple',)
<class 'tuple'>

Without the comma, Python does not treat it as a tuple:

item = ("apple")
print(type(item))

Output:

<class 'str'>

Empty tuple

empty = ()
print(empty)

Output:

()

For more detail, see creating a tuple in Python.

How to use tuple values

Even though tuples cannot be changed item by item, you can still read and use their values.

  • Access items with an index
  • Use slicing to get part of a tuple
  • Loop through a tuple with a for loop
  • Use len() to get the number of items

Access an item by index

letters = ("a", "b", "c")
print(letters[0])
print(letters[1])

Output:

a
b

If needed, learn more about tuple indexing in Python.

Get part of a tuple with slicing

numbers = (10, 20, 30, 40, 50)
print(numbers[1:4])

Output:

(20, 30, 40)

You can read more in tuple slicing explained.

Loop through a tuple

days = ("Mon", "Tue", "Wed")

for day in days:
    print(day)

Output:

Mon
Tue
Wed

Get the number of items

days = ("Mon", "Tue", "Wed")
print(len(days))

Output:

3

See also how len() works with tuples.

When beginners should use tuples

Tuples are a good choice when the data should stay fixed.

Use a tuple for:

  • fixed data, like days of the week or coordinates
  • values that should not be changed by mistake
  • grouped values that belong together

Examples:

days_of_week = ("Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday")
point = (10, 20)

print(days_of_week[0])
print(point)

Output:

Monday
(10, 20)

Use a list instead when you need to add, remove, or change items.

If you are comparing the two, see what is a list in Python and when to use lists vs tuples vs sets vs dictionaries.

Important beginner note

There is one detail that often confuses beginners.

  • A tuple itself cannot be changed after creation
  • But a tuple can contain mutable objects, such as lists
  • This page defines the term only
  • Use the main tuple learning and reference pages for indexing, slicing, and methods

Example:

data = ([1, 2], [3, 4])
data[0].append(99)

print(data)

Output:

([1, 2, 99], [3, 4])

The tuple still exists in the same structure, but the list inside it was changed.

So when people say a tuple is immutable, they mean:

  • you cannot replace tuple items directly
  • but objects inside the tuple might still be mutable

FAQ

Is a tuple the same as a list?

No. Both store multiple values in order, but a list can be changed and a tuple cannot be changed item by item.

Why would I use a tuple instead of a list?

Use a tuple when the data should stay fixed, such as coordinates, settings, or known values.

Can a tuple contain different data types?

Yes. A tuple can contain strings, numbers, booleans, and other objects.

How do I make a tuple with one item?

Add a comma after the value, like ("apple",). Without the comma, Python does not treat it as a tuple.

See also