Python Lists
💡
Exercise 23

To-Do 10 XP Easy

Ctrl+Enter Run Ctrl+S Save

Lists are mutable — you can change, add, and remove items!

Common list methods:

  • `.append(item)` — adds to the end
  • `.remove(item)` — removes first occurrence
  • `.pop()` — removes and returns the last item
  • `.insert(index, item)` — inserts at a specific position
tasks = ['wake up', 'eat breakfast'] tasks.append('go to school') tasks.remove('eat breakfast') print(tasks) # ['wake up', 'go to school']
📋 Instructions
Create a to-do list and modify it: ```python todo = ['laundry', 'dishes', 'homework'] ``` 1. Add `'exercise'` to the end 2. Remove `'dishes'` 3. Insert `'breakfast'` at index 0 4. Print the final list Expected output: ``` ['breakfast', 'laundry', 'homework', 'exercise'] ```
Use .append(), .remove(), and .insert(0, 'breakfast') in that order. You've got this — take it step by step!
⚠️ Try solving it yourself first — you'll learn more!
tasks = ['wake up', 'eat breakfast']
tasks.append('go to school')
tasks.remove('eat breakfast')
print(tasks)  # ['wake up', 'go to school']
🧪 Test Cases
Input
Run your code
Expected
['breakfast', 'laundry', 'homework', 'exercise']
Expected program output
main.py
Hi! I'm Rex 👋
Output
Ready. Press ▶ Run or Ctrl+Enter.