What's the matter with my code?


#1



File "python", line 17
return cost -= 50
^
SyntaxError: invalid syntax


def rental_car_cost (days) :
    cost = 40 * days
    if days >= 7 :
        return cost -= 50
    elif days >= 3 :
        return cost -= 20
    return cost


#2

Right there you should remove return. That's what the error is pointing at.

Hope this helps. :smile:


#3

Remove the return on row 19 as well. You 'call' the cost on the last row 20


#4

why should i remove return?? can u tell me the reason??


#5

First, that was where the interpreter error was pointing at. Second, that would be like doing it twice to return twice. Thirdly, the indentation of that return isn't on right loop.

I hope I helped! :smile: