SyntaxError: 'return' outside function


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

I keep getting a SyntaxError: 'return' outside function and I've tried using the Q/A to rectify my code, but it just isn't working. It's giving me the same error for the previously established codes as well.


look at this code:

def example():
    print "i am inside the function"

print "i am outside"

see how i indent to place print in or outside the function


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