Професионална програма
Loading...
KALOYAN_123 avatar KALOYAN_123 34 Точки

7. Easter Gifts

Здравейте, имам проблем с задача 07.Easter Gifts от Exercise-a на List Basics. Всичко ми изглежда наред, само че последните 3 теста гърмят.

Условието на задачата е:

https://softuni.bg/downloads/svn/soft-tech/May-2020/Python/03-Lists-Basic/03-Lists-Basics-Exercise.docx

 

Моето решение:

https://pastebin.com/DGc821nz

0
Fundamentals Module
D.V.Ivanov avatar D.V.Ivanov 2 Точки
gifts = input().split()
command = input()

while not command == "No Money":
    command = command.split()
    if "OutOfStock" in command:
        for i in range(len(gifts)):
            if command[1] in gifts[i]:
                gifts[i] = "None"
    elif "Required" in command:
        for i in range(len(gifts)):
            if i == int(command[2]):
                gifts[i] = command[1]
    elif "JustInCase" in command:
        gifts[-1] = command[1]
    command = input()
while "None" in gifts:
    gifts.remove("None")
for i in gifts:
    print(i, end=" ")
0