Transportation


#1



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):
    return 40 * days
    
    if days >= 7:
      cost -= 50
      
    elif days >= 3:
        cost -= 20
        
    return cost
        

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

Need help.


#2

a function ends the moment a return keyword is reached


#3

This line is where you initially set cost. Do not return until the end of the function (which you have in place).


#4

Hi @htcoder,

Instead of this ...

return 40 * days

... you should initialize cost ...

cost = 40 * days

#5

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