Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #7 Easter Gifts
- input_gifts = input().split(" ")
- while True:
- command = input()
- if command == "No Money":
- break
- else:
- current_command = command.split(" ")
- if current_command[0] == "OutOfStock":
- for current_gift in input_gifts:
- if current_command[1] == current_gift:
- index_gift = input_gifts.index(current_gift)
- input_gifts[index_gift] = "None"
- elif current_command[0] == "Required":
- for index in range(len(input_gifts)):
- if int(current_command[2]) == index:
- input_gifts[index] = current_command[1]
- elif current_command[0] == "JustInCase":
- index_last_gift = len(input_gifts) - 1
- input_gifts[index_last_gift] = current_command[1]
- list_of_gifts = []
- for gift in input_gifts:
- if gift != "None":
- list_of_gifts.append(gift)
- print(" ".join(list_of_gifts))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement