HELP for (07. Easter Gifts) from Lists Basics - Exercise
Здравейте, може ли някой да помогне?
Тази задача я мъчва цял ден по различни начини. Въпреки, че нулевите тестове излизат, повече от 40/100 не успях да постигнa в Judge.
Благодаря предварително!
gift_names = input()
gift_names_list = gift_names.split()
length = len(gift_names_list)
gift = ''
is_no_money = False
command = input()
command_list = command.split()
while not is_no_money:
if command_list[0] == 'OutOfStock' and command_list[1] in gift_names_list:
gift = command_list[1]
index = gift_names_list.index(gift)
gift_names_list[index] = 'None'
if command_list[1] in gift_names_list:
continue
if command_list[0] == 'Required' and int(command_list[2]) <= length - 1:
gift = command_list[1]
gift_names_list[2] = gift
if command_list[0] == 'JustInCase':
gift = command_list[1]
gift_names_list[-1] = gift
command = input()
command_list = command.split()
if command == 'No Money':
is_no_money = True
for items in gift_names_list:
if items == 'None':
gift_names_list.remove('None')
break
print(' '.join(gift_names_list))