6. Hey, You Never Know!


#1



https://www.codecademy.com/courses/python-beginner-P5YtY/1/5?curriculum_id=4f89dab3d788890003000096


Error: Oops, try again. trip_cost('Tampa', 8, 0) raised an error: global name 'spending_money' is not defined


I'm not sure what to do :confused:


def hotel_cost(nights):
    # $140/night
    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):
    
    if days >= 7:
        return 40 * days - 50
    elif days >= 3:
        return 40 * days - 20
    else:
        return 40 * days

def trip_cost(city, days, money):
    return rental_car_cost(days) + hotel_cost(days) + plane_ride_cost(city) + spending_money


#2

your trip cost parameter is money, this should be spending_money


#3

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