-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrpg_inv.py
More file actions
50 lines (42 loc) · 1.41 KB
/
Copy pathrpg_inv.py
File metadata and controls
50 lines (42 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
inventory=[]
while True:
#User selects option
menu = ("View inventory", "Add item", "Remove item", "Exit")
for options in menu:
print(options)
user_input= input("Select an option: ")
#Inventory Validation
if user_input == "View inventory":
if len(inventory)<1:
print("Inventory is empty")
else:
for items in inventory:
print(items)
print("*************"*3)
if user_input == "Add item":
add_item = input("Enter item:")
if len(inventory)>=6:
print("Inventory is full")
elif add_item == "":
print("Item cannot be empty")
else:
inventory.append(add_item)
print(f"Added {add_item}")
print("*************"*3)
if user_input == "Remove item":
if len(inventory)<1:
print("Inventory is empty")
for items in inventory:
print(items)
remove_item= input("Which item would you like to remove:")
if remove_item=="":
print("Enter an item in the inventory")
elif remove_item not in inventory:
print("The item is not found")
else:
inventory.remove(remove_item)
print(f"Removed {remove_item}")
print("*************"*3)
if user_input == "Exit":
print("Thank you for testing the system")
break