Advertisement
viligen

easter_gifts

Oct 2nd, 2021
1,160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.84 KB | None | 0 0
  1. gifts_list = input().split()
  2.  
  3. command_list = []
  4. while True:
  5.     command = input()
  6.     if command == "No Money":
  7.         break
  8.     elif "OutOfStock" in command:
  9.         command_list = command.split()
  10.         for i in range(len(gifts_list)):
  11.             if command_list[1] in gifts_list:
  12.                 index = gifts_list.index(command_list[1])
  13.                 gifts_list[index] = "None"
  14.  
  15.     elif "Required" in command:
  16.         command_list = command.split()
  17.         if 0 <= int(command_list[2]) < len(gifts_list):
  18.             gifts_list[int(command_list[2])] = command_list[1]
  19.  
  20.     elif "JustInCase" in command:
  21.         command_list = command.split()
  22.         gifts_list[len(gifts_list) - 1] = command_list[1]
  23.  
  24.  
  25. for i in range(len(gifts_list)):
  26.     if "None" in gifts_list:
  27.         gifts_list.remove("None")
  28.  
  29. print(*gifts_list)
  30.  
  31.  
  32.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement