What are lists?
Lists are Python’s most versatile data structure. They’re like containers that can hold multiple items in a specific order. Think of a list like:- A shopping list (milk, eggs, bread)
- A to-do list (tasks in order)
- A playlist (songs in sequence)
Creating lists
Lists use square brackets
[] and items are separated by commas. You can mix different data types in the same list!Accessing items
Lists are indexed starting at 0:Changing lists
Lists are mutable - you can change them:List methods
Checking lists
Common mistakes
Index out of range
Index out of range
Modifying while looping
Modifying while looping
Shallow copy issues
Shallow copy issues
What’s next?
Now let’s learn about dictionaries - perfect for storing related information!Dictionaries
Key-value pairs