Advertisement
pacho_the_python

Untitled

Feb 23rd, 2022
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.94 KB | None | 0 0
  1. inventory = input().split(", ")
  2.  
  3. command = input().split(" - ")
  4.  
  5. while True:
  6.     if command[0] == "Craft!":
  7.         break
  8.  
  9.     if command[0] == "Collect":
  10.         collect_item = command[1]
  11.         if collect_item not in inventory:
  12.             inventory.append(collect_item)
  13.  
  14.     elif command[0] == "Drop":
  15.         drop_item = command[1]
  16.         if drop_item in inventory:
  17.             inventory.remove(drop_item)
  18.  
  19.     elif command[0] == "Combine Items":
  20.         combine = command[1]
  21.         old_new = combine.split(":")
  22.         old_item = old_new[0]
  23.         new_item = old_new[1]
  24.         if old_item in inventory:
  25.             inventory.insert(inventory.index(old_item) + 1, new_item)
  26.  
  27.     elif command[0] == "Renew":
  28.         renew_item = command[1]
  29.         if renew_item in inventory:
  30.             inventory.remove(renew_item)
  31.             inventory.append(renew_item)
  32.  
  33.     command = input().split(" - ")
  34.  
  35. print(", ".join(inventory))
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement