Python Data Structure Differences (CBSE Class 12 Computer Science)
List vs Tuple
Feature List Tuple
Definition Ordered collection of items Ordered collection of items
Mutability Mutable (can be changed) Immutable (cannot be
changed)
Brackets Used [] ()
Performance Slightly slower Faster than lists
Modification Items can be added or Items cannot be modified
removed
Example numbers = [1,2,3] numbers = (1,2,3)
List vs Dictionary
Feature List Dictionary
Data Storage Stores items in sequence Stores key–value pairs
Brackets Used [] {}
Access Method Using index numbers Using keys
Order Ordered Ordered (Python 3.7+)
Example [10,20,30] {'name':'Ashwin','marks':95}
Tuple vs Dictionary
Feature Tuple Dictionary
Structure Ordered collection of values Collection of key–value
pairs
Mutability Immutable Mutable
Brackets () {}
Access By index By key
Example (10,20,30) {'a':10,'b':20}