23
loading...
This website collects cookies to deliver better user experience
pam_inv = {}
backpack = {}
home_inv = {1: "Keys", 2: "Phone", 3: "Wallet", 4: "Headphones",
5: "Charger", 6: "Laptop", 7: "Water", 8: "Food", 9: "Backpack"}
print("I need to pack my things quickly! What do I need?")
print("\n")
print(" Items nearby ".center(25, "#"))
for key, value in home_inv.items():
print(str(key).ljust(20, "."), value.rjust(5, " "))
print("Press a number + ENTER to collect an item. To quit press Q + ENTER")
while True:
choice = input()
if choice.lower() == "q":
break
if choice.isdecimal() == False or (int(choice) < 1 or int(choice) > 9):
print("Pick a number from 1 to 9 and press ENTER. To quit press Q + ENTER")
continue
if 9 not in pam_inv.keys() and (int(choice) >= 5 and int(choice) <= 8):
print("You can't put this in your pockets. You need a backpack.")
continue
pam_inv.setdefault(int(choice), home_inv.get(int(choice)))
print(" Inventory: ".center(20, "#"))
for item in pam_inv.values():
print(item.ljust(20, "."))
print("Till next time!")