Taking a vacation


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


looks fine, do you have a question and/or error message?


First, you don't use return until the last line.
Second, you don't need the else statement in this situation.
Third, following the if and elif lines, you should use rental_cost -= [whichever number].
-= (minus, equal). The return will follow the elif rental_cost-= #.


there are multiply ways to solve the problem. @alice.beriozza code is also a way to solve the problem


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