Saturday, October 17, 2026 New tutorials published every day
Home
Tutorials
Core PHP PHP Course JavaScript React & Next.js Python WordPress Artificial Intelligence
Course
Lesson 1 — Start Here Course playlist Lesson notes & code
Projects
PHP Projects — all projects
More
About Contact Search Login
Python

Python List vs Tuple: What Is the Difference and When to Use Each?

The main difference between a Python list and a tuple is simple: a list can be changed after creation, a tuple cannot. Learn with examples when to use each.

Python List vs Tuple: What Is the Difference and When to Use Each?

The main difference between a list and a tuple in Python is change. A list is mutable, which means you can add, remove, or change its items after you create it. A tuple is immutable, which means once you create it, its items can never change. Lists use square brackets [ ] and tuples use round brackets ( ). In this guide, you will learn both with simple examples and know exactly when to use each one.

What Is a List in Python?

A list is an ordered collection of items. The items can be numbers, strings, or even a mix of types. Because a list can change, it is perfect for data that grows or updates, like a shopping cart or a list of students in a class.

fruits = ["apple", "banana", "mango"]

fruits.append("orange")       # add an item
fruits[0] = "green apple"     # change an item

print(fruits)
# ['green apple', 'banana', 'mango', 'orange']

Lists come with many helpful methods, such as append(), remove(), sort() and reverse(). You will use lists in almost every Python program you write.

What Is a Tuple in Python?

A tuple looks almost the same as a list, but it uses round brackets, and its items are fixed forever. Tuples are perfect for data that should never change, like the days of the week, GPS coordinates, or RGB colour values.

point = (10, 20)

print(point[0])   # 10
print(point[1])   # 20

# point[0] = 15   # This line gives an error!

If you try to change a tuple item, Python stops you with a TypeError. This is not a weakness — it is protection. Python is also the main language behind modern AI tools, as we explain in our article on the generative AI revolution, so these basics are worth learning well.

Python list vs tuple difference illustration
A list is open and changeable, while a tuple stays locked and fixed.

The Main Difference: Mutable vs Immutable

This one idea explains everything. Mutable means "can change." Immutable means "cannot change." Watch what happens when we try the same operation on both:

my_list = [1, 2, 3]
my_list[0] = 99        # works fine
print(my_list)         # [99, 2, 3]

my_tuple = (1, 2, 3)
my_tuple[0] = 99       # TypeError: 'tuple' object
                       # does not support item assignment

Because tuples cannot change, Python can trust them more. For example, only immutable things can be used as dictionary keys, so a tuple can be a key but a list cannot.

List vs Tuple: Comparison Table

PointListTuple
BracketsSquare [ ]Round ( )
Can change items?Yes (mutable)No (immutable)
SpeedA little slowerA little faster
MemoryUses more memoryUses less memory
MethodsMany methods like append, sortOnly count and index
Best forData that changesFixed data
ExampleShopping cart itemsLatitude and longitude

When Should You Use a List?

  • Your data will grow, like users signing up on your website.
  • You need to sort, add, or remove items again and again.
  • You are collecting results in a loop, one item at a time.
  • All items are of the same type, like a list of marks or prices.

When Should You Use a Tuple?

  • Your data must never change, like month names or fixed settings.
  • You want to protect data from accidental changes in a big program.
  • You need a dictionary key, which only immutable types can be.
  • A function returns multiple values together, like a name and an age.

Whichever one you choose, save your practice files properly. Our guide on what GitHub is and why it is important shows the best way to store and share your Python learning projects.

Can You Convert a List into a Tuple?

Yes, and it is very easy. Python gives you two built-in functions for this:

numbers = [1, 2, 3]

fixed = tuple(numbers)     # list to tuple
print(fixed)               # (1, 2, 3)

back = list(fixed)         # tuple to list
print(back)                # [1, 2, 3]

A common trick is to build and edit your data in a list, and then convert it into a tuple at the end when you want to lock it.

How to Choose in 5 Seconds: A Simple Trick

Still confused which one to pick? Ask yourself one question: "Will this data change later?" If the answer is yes, take a list. If the answer is no, take a tuple. That is honestly the whole secret. Think of a list as a notebook with a pencil — you can write, erase, and write again. Think of a tuple as text printed in a book — it stays the same forever, and that is exactly why you can trust it. One more small detail: a list normally holds items of the same type, like only names or only marks, while a tuple often holds a small fixed group of different things together, like a name, an age and a city describing one person.

Frequently Asked Questions

Which is faster, a list or a tuple?

A tuple is slightly faster and uses less memory, because Python knows its size can never change. For small programs you will not feel any difference, so choose based on whether the data should change.

Can a tuple contain a list inside it?

Yes. A tuple can hold a list as one of its items, and that inner list can still change. The tuple itself stays fixed — you cannot replace the item, but the list inside it is still a normal list.

How do I create a tuple with only one item?

Add a comma after the item, like single = (5,). Without the comma, (5) is just a number in brackets, not a tuple.

Are strings mutable or immutable in Python?

Strings are immutable, like tuples. You cannot change one letter of a string; you can only create a new string. Numbers and tuples are also immutable, while lists, sets and dictionaries are mutable.

Conclusion

Lists and tuples are both ordered collections in Python, but they are built for different jobs. Use a list when your data needs to change, and use a tuple when your data must stay fixed and safe. Remember the one-line rule — list is mutable, tuple is immutable — and you will always pick the right one. Try both examples in your Python editor today and see the difference yourself.

Lavkush
Written by

Lavkush

Lavkush is a software developer with 5+ years of experience in the software industry, specialising in PHP and MySQL web development. Over the years he has built business websites, WordPress platforms and complete web applications — admin panels, login systems, dashboards and more. Through CodingCush, he turns that real project experience into simple, step-by-step tutorials with full working code, so students and beginners can learn by building real things, not just by reading theory. He also teaches on the Coding Cush YouTube channel, where his free PHP & MySQL Website Course builds a complete website, lesson by lesson.

0 Comments

Leave a Comment