Python Tuple: Creating a Tuple

A tuple is a simple way to store multiple values in one object. This page shows how to create tuples in Python, including empty tuples, one-item tuples, and tuples made from other iterable values.

The focus here is only on tuple creation syntax. If you want a general introduction, see what is a tuple in Python or Python tuples explained.

Quick example

numbers = (1, 2, 3)
empty = ()
one_item = (5,)
from_list = tuple(["a", "b", "c"])

print(numbers)
print(empty)
print(one_item)
print(from_list)

Output:

(1, 2, 3)
()
(5,)
('a', 'b', 'c')

Use parentheses for most tuples. For one item, add a trailing comma: (5,).

What this page covers

  • What a tuple is at a basic level
  • How to create tuples with literal syntax
  • How to create an empty tuple
  • How to create a tuple with one item
  • How to create a tuple from a list, string, or other iterable
  • When tuple creation is useful

Basic tuple creation

A tuple is an ordered collection of values.

Tuples are usually written with parentheses, and items are separated by commas.

numbers = (1, 2, 3)
print(numbers)

Output:

(1, 2, 3)

A tuple can also store different data types:

data = (1, "apple", True)
print(data)

Output:

(1, 'apple', True)

If you later want to get values out of a tuple by position, see Python tuple indexing explained.

Create an empty tuple

Use empty parentheses to create an empty tuple:

empty = ()
print(empty)
print(type(empty))

Output:

()
<class 'tuple'>

An empty tuple can be useful as a starting value.

It is different from an empty list:

  • Empty tuple: ()
  • Empty list: []

If you want to compare tuple and list creation, see Python list: creating a list.

Create a tuple with one item

This is a very common beginner mistake.

A single value inside parentheses is not automatically a tuple:

value = (5)
print(value)
print(type(value))

Output:

5
<class 'int'>

To create a tuple with one item, you must add a trailing comma:

one_item = (5,)
print(one_item)
print(type(one_item))

Output:

(5,)
<class 'tuple'>

Correct:

("apple",)

Wrong:

("apple")

The comma is what makes it a tuple.

Create tuples with different value types

A tuple can contain many kinds of values.

Numbers

numbers = (1, 2, 3)
print(numbers)

Strings

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

Mixed values

mixed = (1, "apple", True)
print(mixed)

Nested values

You can also put other collections inside a tuple:

nested = (1, ("a", "b"), [10, 20])
print(nested)

Output:

(1, ('a', 'b'), [10, 20])

Create a tuple with tuple()

You can use the built-in tuple() function to convert another iterable into a tuple.

If you want more detail about this function, see Python tuple() function explained.

From a list

numbers = tuple([1, 2, 3])
print(numbers)

Output:

(1, 2, 3)

From a string

letters = tuple("abc")
print(letters)

Output:

('a', 'b', 'c')

This works because a string is iterable, so Python goes through it one character at a time.

From another iterable

values = tuple(range(4))
print(values)

Output:

(0, 1, 2, 3)

This is useful when your data already exists in another form and you want a tuple version of it.

Important beginner notes

  • Commas create tuple items.
  • Parentheses help readability, but the commas matter most.
  • Tuples cannot be changed after creation.
  • If you need to change items often, use a list instead.

For a bigger comparison, see when to use lists vs tuples vs sets vs dictionaries.

Common mistakes

Here are some common problems beginners run into when creating tuples.

Forgetting the comma in a one-item tuple

This creates a normal value, not a tuple:

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

To fix it, add a comma:

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

Using square brackets by mistake

This creates a list, not a tuple:

values = [1, 2, 3]
print(type(values))

If you want a tuple, use parentheses:

values = (1, 2, 3)
print(type(values))

Expecting tuple items to be changeable

Tuples cannot be changed after creation.

numbers = (1, 2, 3)
# numbers[0] = 10  # This would cause an error

If you need to update items, use a list instead.

Confusing tuple("abc") with one string inside a tuple

This:

letters = tuple("abc")
print(letters)

gives:

('a', 'b', 'c')

If you want one string as a single tuple item, write:

word = ("abc",)
print(word)

Output:

('abc',)

Simple debugging checks

If you are not sure what you created, these checks help:

my_tuple = ("apple",)

print(my_tuple)
print(type(my_tuple))
print(len(my_tuple))

FAQ

How do I create a tuple with one item?

Add a trailing comma, like ("apple",). Without the comma, Python treats it as a normal value.

Do tuples always need parentheses?

Parentheses are common and clearer for beginners, but commas are what make a tuple.

Can a tuple contain different data types?

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

What is the difference between a tuple and a list?

A tuple cannot be changed after creation. A list can be changed.

What does tuple("abc") return?

It returns ('a', 'b', 'c') because the string is treated as an iterable of characters.

See also