Advertisement
Spocoman

07. Easter Gifts

Jan 23rd, 2022
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.54 KB | None | 0 0
  1. gifts = input().split(' ')
  2. command = input()
  3.  
  4. while command != 'No Money':
  5.     commands = command.split(' ')
  6.     if commands[0] == 'OutOfStock':
  7.         gifts = list(map(lambda x: x if x != commands[1] else 'None', gifts))
  8.     elif commands[0] == 'Required':
  9.         if 0 <= int(commands[2]) < len(gifts):
  10.             gifts[int(commands[2])] = commands[1]
  11.     elif commands[0] == 'JustInCase':
  12.         gifts[len(gifts) - 1] = commands[1]
  13.     command = input()
  14.  
  15. gifts = list(filter(lambda a: a != 'None', gifts))
  16. print(' '.join(gifts))
  17.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement