BdW44222

07. Easter Gifts

Jul 1st, 2021
926
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. gift_names = [gift for gift in input().split()]
  2. commands_input = input()
  3.  
  4. while not commands_input == "No Money":
  5.     command = commands_input.split()[0]
  6.     gift = commands_input.split()[1]
  7.  
  8.     if command == "OutOfStock":
  9.         for i in range(len(gift_names)):
  10.             if gift[i] == "gift":
  11.                 gift[i] = "None"
  12.     if command == "Required":
  13.         index = int(commands_input.split()[2])
  14.         if 0 <= index < len(gift_names):
  15.             gift_names[index] = gift
  16.  
  17.     if command == "JustInCase":
  18.         gift_names[-1] = gift
  19.  
  20.     commands_input = input()
  21.  
  22. no_none = [el for el in gift_names if not el == "None"]
  23. print(" ".join(no_none))
  24.  
  25.  
  26.  
RAW Paste Data