Problem: Given a Python list with n
elements. How to convert it into a tuple with the same n
elements?
Examples:
- Convert list
[1, 2, 3, 4, 5]
into tuple(1, 2, 3, 4, 5)
. - Convert list
['Alice', 'Bob', 'Ann']
into tuple('Alice', 'Bob', 'Ann')
. - Convert list
[1]
into tuple(1,)
.
Note Tuple: Tuples are similar to lists—with the difference that you cannot change the tuple values (tuples are immutable) and you use parentheses rather than square brackets.
Solution: Use the built-in Python tuple()
function to convert a list into a tuple. You don’t need to import any external library.
Code: The following code converts the three given lists into tuples.
list_1 = [1, 2, 3, 4, 5] print(tuple(list_1)) # (1, 2, 3, 4, 5) list_2 = ['Alice', 'Bob', 'Ann'] print(tuple(list_2)) # ('Alice', 'Bob', 'Ann') list_3 = [1] print(tuple(list_3)) # (1,)
Try It Yourself: With our interactive code shell, you can try it yourself. As a small exercise, try to convert the empty list []
into a tuple and look what happens.
Explanation: You can see that converting a list with one element leads to a tuple with one element. The tuple()
function is the easiest way to convert a list into a tuple value. Note that the values in the tuple are not copied—only a new reference to the same element is created:

The graphic also shows how to convert a tuple back to a list by using the list()
function (that’s also a Python built-in function). Thus, calling list(tuple(lst))
on a list lst
will result in a new list with the same elements.
Related articles:
Try to execute this code with the interactive Python tutor:

While working as a researcher in distributed systems, Dr. Christian Mayer found his love for teaching computer science students.
To help students reach higher levels of Python success, he founded the programming education website Finxter.com that has taught exponential skills to millions of coders worldwide. He’s the author of the best-selling programming books Python One-Liners (NoStarch 2020), The Art of Clean Code (NoStarch 2022), and The Book of Dash (NoStarch 2022). Chris also coauthored the Coffee Break Python series of self-published books. He’s a computer science enthusiast, freelancer, and owner of one of the top 10 largest Python blogs worldwide.
His passions are writing, reading, and coding. But his greatest passion is to serve aspiring coders through Finxter and help them to boost their skills. You can join his free email academy here.