---
title: "What is the difference between a list and a tuple in Python?"  
description: "What is the difference between a list and a tuple in Python?"  
author: "Utpal Vishwas"  
published: 2023-06-26  
updated: 2023-06-27  
canonical: https://www.mindstick.com/forum/158861/what-is-the-difference-between-a-list-and-a-tuple-in-python  
category: "python"  
tags: ["python", "list"]  
reading_time: 3 minutes  

---

# What is the difference between a list and a tuple in Python?

What is the [difference between a list and a tuple](https://www.mindstick.com/forum/161368/what-is-the-difference-between-a-list-and-a-tuple) in [Python](https://www.mindstick.com/articles/75378/simple-yet-useful-tips-when-using-python)?

## Replies

### Reply by Aryan Kumar

Sure. In Python, a list and a [tuple](https://www.mindstick.com/forum/33652/how-to-use-tuple-in-c-sharp) are both data structures that can be used to store a collection of elements. However, there are some key differences between the two:

- **Lists are mutable:** This means that the elements of a list can be changed after the list is created. For example, you can add or remove elements from a list, or you can change the value of an element in a list.
- **Tuples are immutable:** This means that the elements of a tuple cannot be changed after the tuple is created. For example, you cannot add or remove elements from a tuple, or you cannot change the value of an element in a tuple.
- **Lists are enclosed in square brackets:** For example, a list of numbers can be defined as `numbers = [1, 2, 3, 4, 5]`.
- **Tuples are enclosed in parentheses:** For example, a tuple of numbers can be defined as `numbers = (1, 2, 3, 4, 5)`.

Here is a table that summarizes the differences between lists and tuples:

| Feature | List | Tuple |
| --- | --- | --- |
| Mutable | Yes | No |
| Enclosed in | Square brackets `[]` | Parentheses `()` |
| Memory usage | More | Less |
| Speed | Slower | Faster |

drive_spreadsheetExport to Sheets

In general, lists are more versatile than tuples because they can be changed. However, tuples are more efficient because they are immutable.

Here are some examples of when you might use a list:

- To store a collection of data that you need to be able to change, such as a shopping list or a to-do list.
- To iterate over a collection of data, such as when you are searching for a specific element in a list.
- To sort a collection of data, such as when you are ranking a list of students by their grades.

Here are some examples of when you might use a tuple:

- To store a collection of data that you do not need to be able to change, such as the coordinates of a point on a map.
- To pass a collection of data to a function, where the function does not need to be able to change the data.
- To return a collection of data from a function.

Ultimately, the best way to choose between a list and a tuple depends on your specific needs and requirements.


---

Original Source: https://www.mindstick.com/forum/158861/what-is-the-difference-between-a-list-and-a-tuple-in-python

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
