Difference Between List and Tuple in Python (Table + Examples)
List is mutable, tuple is immutable — but there are 6 more differences interviewers expect. Full comparison table with memory and speed proof.
The one-line answer
[ ], tuple uses ( ). But interviews expect more — here are all 7 differences.my_list = [10, 20, 30] # list - square brackets
my_tuple = (10, 20, 30) # tuple - round brackets
my_list[0] = 99 # OK: list changed
my_tuple[0] = 99 # TypeError: 'tuple' object does not
# support item assignment
Full comparison table (7 differences)
| Point | List | Tuple |
|---|---|---|
| Mutability | Mutable — add/remove/change | Immutable — locked forever |
| Syntax | [1, 2, 3] | (1, 2, 3) |
| Methods | 11+ (append, remove, sort...) | Only 2 (count, index) |
| Speed | Slower | Faster (fixed size) |
| Memory | More (extra space for growth) | Less (exact fit) |
| Dictionary key | ❌ Cannot be a dict key | ✅ Can be a dict key |
| Use case | Data that changes (cart items) | Fixed data (coordinates, dates) |
Memory proof (run this yourself)
import sys
l = [10, 20, 30, 40, 50]
t = (10, 20, 30, 40, 50)
print("List size :", sys.getsizeof(l), "bytes")
print("Tuple size:", sys.getsizeof(t), "bytes")
Same 5 items, tuple takes less memory — because a list reserves extra space for future growth, a tuple never grows.
The dictionary-key difference (interview favourite)
locations = { (28.61, 77.20): "Delhi" } # tuple key: OK
print(locations[(28.61, 77.20)])
wrong = { [28.61, 77.20]: "Delhi" } # TypeError:
# unhashable type: 'list'
Only immutable objects can be dictionary keys. Since a tuple cannot change, Python can hash it; a list can change, so it cannot be hashed.
When to use which?
- Use a list when data will change: shopping cart, student attendance, todo items.
- Use a tuple when data must never change: (latitude, longitude), RGB colours, date of birth, function returning multiple values.
- Interview line: "Tuple is a read-only list — safer, faster and hashable."
One-line answer
[ ] use करती है, tuple ( ). लेकिन interviews में और expect किया जाता है — यहां सभी 7 अंतर हैं.my_list = [10, 20, 30] # list - square brackets
my_tuple = (10, 20, 30) # tuple - round brackets
my_list[0] = 99 # OK: list बदल गई
my_tuple[0] = 99 # TypeError: 'tuple' object does not
# support item assignment
पूरी comparison table (7 अंतर)
| Point | List | Tuple |
|---|---|---|
| Mutability | Mutable — add/remove/change | Immutable — हमेशा के लिए locked |
| Syntax | [1, 2, 3] | (1, 2, 3) |
| Methods | 11+ (append, remove, sort...) | सिर्फ 2 (count, index) |
| Speed | धीमी | तेज़ (fixed size) |
| Memory | ज़्यादा (growth के लिए extra space) | कम (exact fit) |
| Dictionary key | ❌ dict key नहीं बन सकती | ✅ dict key बन सकता है |
| Use case | बदलने वाला data (cart items) | Fixed data (coordinates, dates) |
Memory proof (खुद run करके देखें)
import sys
l = [10, 20, 30, 40, 50]
t = (10, 20, 30, 40, 50)
print("List size :", sys.getsizeof(l), "bytes")
print("Tuple size:", sys.getsizeof(t), "bytes")
Same 5 items, tuple कम memory लेता है — क्योंकि list future growth के लिए extra space reserve करती है, tuple कभी grow नहीं होता.
Dictionary-key वाला अंतर (interview favourite)
locations = { (28.61, 77.20): "Delhi" } # tuple key: OK
print(locations[(28.61, 77.20)])
wrong = { [28.61, 77.20]: "Delhi" } # TypeError:
# unhashable type: 'list'
सिर्फ immutable objects dictionary keys बन सकते हैं. Tuple बदल नहीं सकता, इसलिए Python उसे hash कर सकता है; list बदल सकती है, इसलिए hash नहीं हो सकती.
कब कौन-सा use करें?
- List use करें जब data बदलेगा: shopping cart, student attendance, todo items.
- Tuple use करें जब data कभी नहीं बदलना चाहिए: (latitude, longitude), RGB colours, date of birth, function से multiple values return.
- Interview line: "Tuple एक read-only list है — safer, faster और hashable."
Frequently Asked Questions
What is the main difference between list and tuple?
A list is mutable — items can be added, removed or changed after creation — while a tuple is immutable and cannot be modified once created.
Why is a tuple faster than a list?
A tuple has a fixed size, so Python allocates exact memory once and applies internal optimizations, while a list keeps extra space and bookkeeping for growth.
Can a tuple be used as a dictionary key?
Yes, because tuples are immutable and therefore hashable. Lists cannot be dictionary keys since they can change.