Advertisement
bl00dt3ars

03. Inventory (Plamena Kukleva)

Jul 9th, 2021
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.81 KB | None | 0 0
  1. journal = input().split(", ")
  2. command = input()
  3.  
  4. while not command == "Craft!":
  5.     current_command = command.split(" - ")
  6.     name_of_command = current_command[0]
  7.     item = current_command[1]
  8.  
  9.     if name_of_command == "Collect":
  10.         if item not in journal:
  11.             journal.append(item)
  12.  
  13.     elif name_of_command == "Drop":
  14.         if item in journal:
  15.             journal.remove(item)
  16.  
  17.     elif name_of_command == "Combine Items":
  18.         items = item.split(":")
  19.         old_item = items[0]
  20.         new_item = items[1]
  21.         if old_item in journal:
  22.             journal.insert(journal.index(old_item)+1, new_item)
  23.  
  24.     elif name_of_command == "Renew":
  25.         if item in journal:
  26.             journal.remove(item)
  27.             journal.append(item)
  28.     command = input()
  29.  
  30. print(", ".join(journal))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement