4 Transportation CAR RENTAL COST


Im stuck at car rental cost for the vacation.

The error message is "Oops, try again. It looks like rental_car_cost returns None instead of the correct amount (40) for 1 days. "

How do i fix this?

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


Hello @mandy97x,

Your code accounts only two cases , one if the days are more than 7 ,Other when days are in between 3 and 7.

It's visible that in this code,the days: 0,1,2, are not considered.
So we can either create an elif branch to deal with this or we can directly return the totalcost that will simply handle this ?


to @mandy97x

you should use the example format
at the top of instructions



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