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

Can anybody help me with my code?The error says"Oops, try again. Did you create a function called rental_car_cost?"


Hi @sm0423,

This statement is indented too much, making it part of the elif block ...

return cost


why does this line:

def rental_car_cost(days):

have on space indention?

if the car is rented one or two days, no cost is returned


@stetim94 I did not get you.


well, if the car is rented for 1 day rental_car_cost should return 40, and 80 for 2 days. In your case, None (the default) is returned given no return keyword is reached


So what do i do for it to return 40 or 80 for 1 or 2 days respectively?


Oh,i got it.I just added an else statement at the end asking it to return cost.Thank you for your help.


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