Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- gifts = input().split()
- command = input()
- while command != 'No Money':
- arg = command.split()
- command = arg[0]
- current_gift = arg[1]
- if command == 'OutOfStock':
- gift = current_gift
- for item in range(len(gifts)):
- if gifts[item] == gift:
- gifts[item] = 'None'
- elif command == 'Required':
- idx = int(arg[2])
- if 0 <= idx <= len(gifts):
- gifts[idx] = current_gift
- elif command == 'JustInCase':
- gifts[-1] = current_gift
- command = input()
- result = []
- for gift in gifts:
- if gift is not 'None':
- result.append(gift)
- print(' '.join(result))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement