🏠 Home

🎒 Superhero Gadget Inventory

Objective: Manage your utility belt with Python Lists!

🚀 OPEN GOOGLE COLAB

(Click to open in a new tab)

🚨 The Mission

Every superhero needs to keep track of their gadgets. Batman has his utility belt, and Wonder Woman has her Lasso of Truth. But they carry MANY items!

Instead of making a variable like gadget1, gadget2, gadget3... we can use a LIST!

🗝️ Key Concepts

📦 1. Creating a List:

Lists are like a backpack where you can store multiple things. Use square brackets [].

backpack = ["Map", "Compass", "Flashlight"]
🔍 2. Accessing Items:

Computers start counting at 0! To get the FIRST item, we ask for index 0.

print(backpack[0]) # Prints "Map"
print(backpack[1]) # Prints "Compass"
➕ 3. Adding Items (Append):

Found a new gadget? Use .append() to add it to the end!

backpack.append("Rope")
# Now backpack has ["Map", "Compass", "Flashlight", "Rope"]
❌ 4. Removing Items (Remove):

Lost something or used it up? Use .remove() to take it out.

backpack.remove("Map")
# "Map" is gone forever!

💻 Your Coding Adventure

📜 The Inventory Challenge

1. Create Your Belt:

  • Create a list called gadgets with at least 3 gadgets inside (Strings).

2. Check the First Item:

  • Print the first item in your list using index 0.

3. Add New Gear:

  • Use .append() to add a "Grappling Hook" (or any new item) to your list.
  • Print the list to show it's there.

4. Use a Gadget:

  • Use .remove() to delete one item that you "used".
  • Print the final list.

⚠️ SUPERHERO TIP:

Lists use SQUARE brackets [].

Functions use PARENTHESES ().

Don't mix them up!

💡 Example Output

My first gadget is: Batarang Full Belt: ['Batarang', 'Smoke Bomb', 'Flashlight', 'Grappling Hook'] After using item: ['Smoke Bomb', 'Flashlight', 'Grappling Hook']

📝 Code Submission

Paste your Python code here to check if your inventory system works! (Type it out, no pasting!)

✅ Evaluation Criteria

  • Created a list with [].
  • Accessed an item with [0] (or other index).
  • Used .append() to add an item.
  • Used .remove() to delete an item.
🎒

OFFICIAL QUARTERMASTER

This certifies that

Student Name

Has mastered the
Superhero Inventory System!

Python Path - Day 7