I can't find my syntax error here (Taking a Vacation), please help!



SyntaxError: 'return' outside function

It should work just fine, but there seems to be an error at the 'return total - 50' line.

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


Those lines are not indented enough, so are outside of the function code block.

The first return (line 3) should be removed.


Awesome, I fixed it. Thank you! :slight_smile:


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.