0 XP
Chapter 4
Lists
Store collections — enemies, items, bullets, scores.
Core Concept
A list holds multiple values in order, like an inventory or enemy roster.
Theory
Create a list with square brackets:
inventory = ["sword", "potion", "shield"]
scores = [100, 250, 80, 330]
print(inventory[0]) # "sword" (index starts at 0)
inventory.append("bow") # add item
inventory.remove("potion") # remove item
print(len(inventory)) # how many items
Live Demo — Run & Explore
Try it live
Loading...
Output will appear here…
Exercise 1 / 1
📝 Create a list of 3 power-ups. Loop through them and print each one.
Your solution
Loading...
Output will appear here…
Ask AI Tutor
AI Tutorgemini-3.1-flash-lite-preview
AI
Hi! I'm your AI tutor for Lists. 🎓
Ask me anything about this lesson — what a variable is, why loops are useful, or "why is my code not working?". I'm here to help you understand, not just give you answers!
What's on your mind? 😊