Taking a vacation


#1

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

Oops, try again. It looks like rental_car_cost returns 120 instead of the correct amount (100) for 3 days.

What am I missing here? Thanks in advance


#2

I believe for this instead of return you need cost = to get the right amount.


#3

When I do costs =
I get: Oops, try again. It looks like rental_car_cost returns None instead of the correct amount (40) for 1 days.


#4

Hmm interesting... That is the correct code I know for a fact because it passes in my lesson. Maybe try refreshing? If not, try my code spacing below You have all the right pieces for the lesson to be correct its just not passing for some reason.

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

#5

Also, it might be that instead of return costs you need return cost. Just noticed that.


#6

It passed with your code... I swear I had the exact same thing. Thanks


#7

Yeah I think it was the cost vs costs. You had costs but I had cost. Thankfully it works now and I wish you happy coding! :smiley:


#8

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