Python Data Types – List, Tuple,
and Dictionary
Presented by: Anmol
Class: 12th
Overview:
• Python is a powerful high-level
What are Data Types in Python?
• • Data Types define the type of data a variable can
hold.
• • Python has many built-in types like:
• - Numeric (int, float)
• - Sequence (list, tuple, range)
• - Mapping (dictionary),
• - Boolean, etc.
• • Focus: List, Tuple, and Dictionary.
List – Introduction
• • A list is an ordered, mutable collection.
• • Defined using square brackets: []
• • Example:
• fruits = ['apple', 'banana', 'cherry']
List – Features
• • Ordered: Maintains insertion order.
• • Mutable: Can change items after creation.
• • Allows duplicate values.
• • Can hold mixed data types (int, str, etc.)
List – Common Operations
• my_list = [1, 2, 3, 4]
• my_list.append(5) # Add item
• my_list.remove(2) # Remove item
• my_list[0] = 10 # Modify item
• print(len(my_list)) # Get list length
Tuple – Introduction
• • A tuple is an ordered, immutable collection.
• • Defined using parentheses: ()
• • Example:
• colors = ('red', 'green', 'blue')
Tuple – Features
• • Ordered like lists.
• • Immutable: Cannot modify after creation.
• • Faster than lists for iteration.
• • Can contain mixed data types.
Tuple – Common Uses
• • Store constant data.
• • Return multiple values from functions.
• • Example:
• person = ('Anmol', 17, 'Student')
Dictionary – Introduction
• • A dictionary stores data as key-value pairs.
• • Defined using curly braces: {}
• • Example:
• student = {'name': 'Anmol', 'class': 12}
Dictionary – Features
• • Unordered (before Python 3.7), ordered now.
• • Mutable: Can add, modify or delete items.
• • No duplicate keys allowed.
• • Fast lookup using keys.
Dictionary – Common Operations
• student['age'] = 17 # Add key-value
• del student['class'] # Delete key
• print(student['name']) # Access value
• print(student.keys()) # All keys
Comparison Table
• Feature List Tuple Dictionary
• Ordered Yes Yes Yes (3.7+)
• Mutable Yes No Yes
• Indexed Yes Yes No (uses keys)
• Syntax [] () {key: value}
• Dup. Keys N/A N/A No
When to Use What?
• • List: When the data needs frequent changes.
• • Tuple: Use when data is constant and performance
matters.
• • Dictionary: Best for mapping and fast data retrieval.
Real-Life Examples
• • List: Shopping List - ['milk', 'bread', 'butter']
• • Tuple: RGB Color Code - (255, 0, 0)
• • Dictionary: Student - {'name': 'Anmol', 'marks': 95}
Thank You!
• • Thank you for your attention!
• • Feel free to ask any questions.
• • Happy Coding! 💻🐍