Transportation: Oops, try again. It looks like rental_car_cost returns None instead of the correct amount (40) for 1 days


#1

I am stuck on Taking A Vacation. For some reason, the code hat I put in gives an error (returns None instead of (40)), but when I ran the code on PyCharm, it worked perfectly. What is the problem?
Here is my code:

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


#2

you only return the cost (rent) of renting the cars when your elif condition is true


#3

Thanks for the response. What do you suggest I do? Because, like I said, it works in PyCharm but for some reason the website does not accept the code?


#4

what does run in pycharm mean? Pychar doesn't validate the condition the exercise ask of your code

given you are reducing rent, i would place after the if/elif condition which check if discount needs to be applied


#5

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