5/7 Pull It Together - problem


#1

Hey guys. Ive got a problem with this. I`ve got an error like:
"Oops, try again. rental_car_cost(1) returned None instead of the correct value 40"

I tried some different options. What i`m doing wrong?

"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
    
    else:
        return "None"
        
        
def rental_car_cost(days):
    cost = 40 * days
    if days >= 7:
        cost -= 50
        return cost
    elif days >= 3:
        cost -= 20
        return cost
        
def trip_cost(city , days):
    return rental_car_cost(days) + hotel_cost(days) + plane_ride_cost(city)

#2

Hi @rybecki,

Why is this statement in the rental_car_cost function included in the elif block? ...

        return cost

What happens when the value of days is less than 3?


#3

Hi @appylpye
First of all - youve got my first mistake. I should be elif days <= 3 and days <= 6:
that
s why i couldn`t get the answer.
In the exercise I had to include function that give you an promotion ($20) if you rent a car for 3 or more days.
Anyway, i found the solution for this one. Thanks for reply.
Cheers


#4