Advertisement
George_Ivanov05

11

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