Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- gifts_planned = input()
- gifts_planned_list = gifts_planned.split()
- command = input()
- index_counter = 0
- for counter in range(len(gifts_planned_list)):
- index_counter += 1
- while command != "No Money":
- if 'OutOfStock' in command:
- gift_to_replace = command.split()[1]
- for replace in range(len(gifts_planned_list)):
- if gifts_planned_list[replace] == gift_to_replace:
- gifts_planned_list[replace] = "None"
- elif "Required" in command:
- given_gift = command.split()[1]
- value = int(command.split()[2])
- if 0 <= value < index_counter:
- gifts_planned_list[value] = given_gift
- elif "JustInCase" in command:
- command_list = command.split()
- value = (command[-1])
- command_sliced = command_list[1:2]
- gifts_planned_list[-1] = "".join(command_sliced)
- command = input()
- gifts = [element for element in gifts_planned_list if element != "None"]
- print(" ".join(gifts))
Advertisement
Add Comment
Please, Sign In to add comment