Advertisement
GalinaKG

Easter gift

Jun 5th, 2022
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.75 KB | None | 0 0
  1. name_of_the_gifts = input().split()
  2. command = input()
  3.  
  4. while command != 'No Money':
  5.     command = command.split()
  6.     to_do_command = command[0]
  7.     gift = command[1]
  8. if to_do_command == 'OutOfStock':
  9.         for index in range(len(name_of_the_gifts)):
  10.             if gift in name_of_the_gifts[index]:
  11.                 name_of_the_gifts[index] = 'None'
  12.  
  13.     elif to_do_command == 'Required':
  14.         for index in range(len(name_of_the_gifts)):
  15.             if index == int(command[2]):
  16.                 name_of_the_gifts[index] = command[1]
  17.  
  18.     elif to_do_command == 'JustInCase':
  19.         name_of_the_gifts[-1] = gift
  20. command = input()
  21.  
  22. while 'None' in name_of_the_gifts:
  23.     name_of_the_gifts.remove('None')
  24.  
  25. print(' '.join(name_of_the_gifts))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement