Please help :python: taking a vacation


#1


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

Oops, try again. trip_cost('Tampa', 2) raised an error: global name 'nights' is not defined


return the trip_cost amount


def hotel_cost(nights):
    return 140 * nights       #The hotel costs $140 per night.
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):
    car_rent = 40 * days
    if days >= 7: 
        return car_rent - 50    #$50 discount if equal to or more 
    elif days >= 3:             #then 7 days
        return car_rent - 20    #$20 discount if 3 or more days
    return car_rent
def trip_cost(city, days):
    return hotel_cost(nights) + plane_ride_cost(city) + rental_car_cost(days)


#2

Hi this part

 return hotel_cost(nights) + plane_ride_cost(city) + rental_car_cost(days)

instead of nights put days inside the hotel_cost()


#3

it works thanks wizmacro :slightly_smiling::clap::+1: