Advertisement
anton_d

07.easter_gifts

Jun 15th, 2022
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.69 KB | None | 0 0
  1. gifts = input()
  2. gifts_list = gifts.split(" ")
  3.  
  4. while True:
  5.     command = input().split(" ")
  6.     if command[0] == "No" and command[1] == "Money":
  7.         break
  8.     if command[0] == "OutOfStock":
  9.         for idx, ele in enumerate(gifts_list):
  10.             if ele == command[1]:
  11.                 gifts_list[idx] = "None"
  12.                 # gifts_list.remove(str(command[1]))
  13.     elif command[0] == "Required":
  14.         gifts_list[2], command[1] = command[1], gifts_list[2]
  15.     elif command[0] == "JustInCase":
  16.         gifts_list[-1], command[1] = command[1], gifts_list[-1]
  17. for idx, ele in enumerate(gifts_list):
  18.     if ele == "None":
  19.         gifts_list.remove(ele)
  20. print(" ".join(gifts_list))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement