
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
Difference between List and Tuples in Python.
List
List is a container to contain different types of objects and is used to iterate objects.
Example
list = ['a', 'b', 'c', 'd', 'e']
Tuples
Tuple is also similar to list but contains immutable objects. Tuple processing is faster than List.
Example
tuples = ('a', 'b', 'c', 'd', 'e')
Following are the important differences between List and Tuple.
Sr. No. | Key | List | Tuple |
---|---|---|---|
1 | Type | List is mutable. | Tuple is immutable. |
2 | Iteration | List iteration is slower and is time consuming. | Tuple iteration is faster. |
3 | Appropriate for | List is useful for insertion and deletion operations. | Tuple is useful for readonly operations like accessing elements. |
4 | Memory Consumption | List consumes more memory. | Tuples consumes less memory. |
5 | Methods | List provides many in-built methods. | Tuples have less in-built methods. |
6 | Error prone | List operations are more error prone. | Tuples operations are safe. |
- Related Articles
- Combining tuples in list of tuples in Python
- What's the difference between lists and tuples in Python?
- Count tuples occurrence in list of tuples in Python
- Remove duplicate tuples from list of tuples in Python
- Difference Between List and Tuple in Python
- Convert list of tuples into list in Python
- Convert list of tuples to list of list in Python
- Summation of tuples in list in Python
- Flatten Tuples List to String in Python
- Remove tuples from list of tuples if greater than n in Python
- Python program to find Tuples with positive elements in List of tuples
- Finding frequency in list of tuples in Python
- Custom sorting in list of tuples in Python
- Update a list of tuples using another list in Python
- Convert list of strings to list of tuples in Python

Advertisements