Advertisement
bl00dt3ars

07. Easter Gifts (Nikola Slavchev)

Jun 5th, 2021
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.81 KB | None | 0 0
  1. gifts_list = input().split(" ")
  2.  
  3. command_1 = "OutOfStock"
  4. command_2 = "Required"
  5. command_3 = "JustInCase"
  6.  
  7. command_end = "No Money"
  8. command = input()
  9.  
  10. while command != command_end:
  11.     list_of_command = command.split(" ")
  12.  
  13.     if list_of_command[0] == command_1:
  14.         for gift in gifts_list:
  15.             if gift == list_of_command[1]:
  16.                 index_of_el = gifts_list.index(gift)
  17.                 gifts_list[index_of_el] = "None"
  18.  
  19.     elif list_of_command[0] == command_2:
  20.         if 0 <= int(list_of_command[2]) < len(gifts_list):
  21.             gifts_list[int(list_of_command[2])] = list_of_command[1]
  22.  
  23.     elif list_of_command[0] == command_3:
  24.         gifts_list[-1] = list_of_command[1]
  25.  
  26.     command = input()
  27.  
  28. for gift in gifts_list:
  29.     if gift != "None":
  30.         print(gift, end=" ")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement