What's the matter with my code?


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


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

Hope this helps. :smile:


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


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


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: