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


def hotel_cost(nights):
    return 140 * nights
def plane_ride_cost(city):
    if city == "Charlotte":
        return 183
    elif city == "Tampa":
        return 220
    elif city == "Pittsburgh":
        return 222
    elif city == "Los Angeles":
        return 475
def rental_car_cost(days):
    price = 40 * days
    if days >= 7:
        price -= 50 
    elif days >= 3:
        price -= 20
    elif days > 1:
        return price


your rental_car_cost function know only returns price when i am renting the car for two days. What about all the other days?


so how to fix it? may be to put one more


why do you have this condition:

elif days > 1:

i would remove it, and instead just return price


i put it this way, still error

def rental_car_cost(days):
price = 40 * days
if days >= 7:
elif days >= 3:
return price


sorry this way

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


return should always be reached, currently this is only happening when i rent the car for: 3, 4,5 or 6 days. Not less then 3 or more then 7

why did you do:

price - 50

this will not update price, unlike price -= 50


changed it - to -= still problem



what about return? Is it reached in all cases? Maybe change the indent of return? Or add multiply return statements, be careful: a function ends the moment a return keyword is reached

seems return isn't reached when i rent a car for less then 3 days or 7 days or more


so please help - how to fix this for less than 3 days?


well look:

if True:
   print True
elif False:
   print False
print "always"

i print "always" regardless of the conditions. Maybe you can do the same with your return price? You update price with the if/elif condition and then you return it afterwards? Not only if elif is true?


This really helped me. :thumbsup: :thumbsup: Keep up the good work.


Good to hear that i helped someone :slight_smile:


thanks, i fixed it just put other var print, other than price