Skip to content
Related Articles

Related Articles

Python | Difference Between List and Tuple

View Discussion
Improve Article
Save Article
  • Difficulty Level : Easy
  • Last Updated : 25 Jul, 2022

List and Tuple in Python are the class of Python Data Structure. The list is dynamic, whereas the tuple has static characteristics. 

What is a List in Python?

The List is just like the arrays, declared in other languages. Lists need not be homogeneous always which makes it the most powerful tool in Python. In Python, the list is a type of container in Python Data Structures, which is used to store multiple data at the same time. Lists are a useful tool for preserving a sequence of data and further iterating over it. 

Syntax of List

list_data = ['an', 'example', 'of', 'a', 'list']

What is a Tuple in Python?

A Tuple is also a sequence data type that can contain elements of different data types, but these are immutable in nature. In other words, a tuple is a collection of Python objects separated by commas. The tuple is faster than the list because of static in nature. 

Syntax of Tuple

tuple_data = ('this', 'is', 'an', 'example', 'of', 'tuple')

Difference Between List and Tuple in Python

1Lists are mutableTuples are immutable
2The implication of iterations is Time-consumingThe implication of iterations is comparatively Faster
3The list is better for performing operations, such as insertion and deletion.Tuple data type is appropriate for accessing the elements
4Lists consume more memoryTuple consumes less memory as compared to the list
5Lists have several built-in methodsTuple does not have many built-in methods.
6The unexpected changes and errors are more likely to occurIn tuple, it is hard to take place.

 List vs Tuple

Tuples are immutable, whereas lists are mutable, and this is the main distinction between the two. Why does this matter? The values in a list can be changed or modified, while the values of a tuple cannot.


# Creating a List with
# the use of Numbers
# code to test that tuples are mutable
List = [1, 2, 4, 4, 3, 3, 3, 6, 5]
print("Original list ",List)
List[3] = 77
print("Example to show mutablity ", List)


Original list  [1, 2, 4, 4, 3, 3, 3, 6, 5]
Example to show mutablity  [1, 2, 4, 77, 3, 3, 3, 6, 5]

Code to test that tuples are immutable


#code to test that tuples are immutable
tuple1 = (0, 1, 2, 3)
tuple1[0] = 4


Traceback (most recent call last):
  File "", line 3, in
TypeError: 'tuple' object does not support item assignment

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!