LESSON 8
Lists
Learning objective: Store ordered collections in lists.
Understand
Lists hold multiple items in order.
A Python list is written with square brackets. Items have an index starting at 0. You can add with append(), remove items, and loop over them. Lists are one of Python's most-used types.
Analogy: A list is like a numbered shopping list you can add to and cross off.
See It in Action
Creating and using a list:
fruits = ["apple", "pear"]
fruits.append("mango")
print(fruits[0]) # appleHow it works:
append adds an item to the end, and fruits[0] reads the first item by index.Try It Yourself
- Create a list of three items.
- Append a fourth item.
- Loop over the list and print each.
Quick Quiz
What index is the first list item?
Challenge
Build a list of tasks, add one, then print them all.
Success condition: Your list grows and prints every item.
+10 XP
Lesson Complete
You answered correctly and completed the required practice. Your progress has been saved on this device.
Continue to next lesson →