Help with error on taking vacation


#1



Error message: Oops, try again. trip_cost('Tampa', 4) raised an error: global name 'plan_ride_cost' is not defined


def hotel_cost(days):
    return 140*days

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


#2

It should be plane_ride_cost as that is what you define the function to be earlier in the program. Simple typo.


#3

and don't forget to get rid of the other parentheses and the end of your code on the last line


#4

@datacoder50384 Incorrect, he is returning that complete statement, which is why there is an open parenthesis at the start. He could either remove both, or leave both.


#5

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