Kaloyankerr

Easter Gifts

Jun 2nd, 2020
347
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. gifts = input().split(' ')
  2.  
  3. command = input().split(' ')
  4. while command[0] != 'No' and command[1] != 'Money':
  5.     index = 0
  6.     if command[0] == 'OutOfStock':
  7.         gift = command[1]
  8.  
  9.         while gift in gifts:
  10.             index = gifts.index(gift)
  11.             gifts[index] = 'None'
  12.  
  13.     elif command[0] == 'Required':
  14.         try:
  15.             if len(gifts) > index >= 0:
  16.                 index = int(command[2])
  17.                 gifts[index] = command[1]
  18.  
  19.         except IndexError:
  20.             pass
  21.  
  22.     elif command[0] == 'JustInCase':
  23.         gifts[-1] = command[1]
  24.  
  25.     command = input().split(' ')
  26.  
  27. while 'None' in gifts:
  28.     gifts.remove('None')
  29.  
  30. for i in gifts:
  31.     print(i, end=' ')
RAW Paste Data