Inventory Manager Project
Build a text-based inventory manager for a video game character. The program uses a list to track the player’s items and lets them view, add, remove, and search their inventory through a menu.
Your program must do the following:
Start with a list of 3 default items (you pick them — sword, health potion, whatever you want).
Display a menu with these options:
1 — View all items2 — Add an item3 — Drop (remove) an item4 — Check if you have an item5 — Show item count6 — QuitKeep looping until the player chooses Quit.
Handle each option:
for loop.
append it.
remove it. If not, print a message saying they
don’t have it.
in to tell them whether it’s in the inventory.
len() to print
how many items they’re carrying.
== INVENTORY MANAGER ==
1. View items
2. Add item
3. Drop item
4. Check for item
5. Item count
6. Quit
Choose an option: 1
Your inventory:
sword
shield
health potion
Choose an option: 2
Item to add: bow
bow added!
Choose an option: 4
Search for: arrow
You do not have arrow.
Choose an option: 6
Goodbye!
Here is a video demo of my version.
| Criteria | Points |
|---|---|
| List created with 3+ starting items | 5 |
| Menu displays and loops correctly | 7 |
| View prints all items | 7 |
Add works using append |
6 |
Drop works using remove, handles missing items |
10 |
Check uses in keyword correctly |
5 |
Count uses len() |
5 |
| Code is clean and has comments | 5 |
| Total | 50 |
Here are some hints to help you with the project:
while True: loop to keep the program
running until the user chooses to quit.
break statement to exit the loop.choice = input("Choose an option: ") to
get user input.
if elif else statement to
handle each menu option.
for loop to print all items in the inventory.append() to add new items to the inventory.remove() to drop items from the inventory.in keyword to check if an item is in the inventory.
len() to get the number of items in the inventory.