Exercise 5: Backpack Manager π
π Lists π For Loops
Your Task
Start with: inventory = ["sword", "potion", "shield"]
Do this in order:
- Print the inventory
- Add "helmet" to the end
- Add "gem" to the beginning
- Remove "potion"
- Print the inventory
- Print: How many items? What's the first item? What's the last item?
- Use a for loop to print each item numbered (1. gem, 2. sword, etc.)
Example Output
['sword', 'potion', 'shield']
['gem', 'sword', 'shield', 'helmet']
4 items
First: gem
Last: helmet
1. gem
2. sword
3. shield
4. helmet