Pull it Together


#1

Hi guys, sorry for my English. It's not very good.

Can anyone help with this error:

"Oops, try again. trip_cost('Los Angeles', 9) raised an error: global name 'nights' is not defined"

def hotel_cost(nights):
night_p = 140
return night_p * 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):
car = 40 * days
if days >= 7:
car -= 50
elif days >= 3:
car -= 20
return car

def tripcost(city, days):
return rentalcarcost(days) + hotelcost(days) + planeride_cost(city)


#2

@designmaster40854,

def hotel_cost(nights):
    night_p = 140
    return night_p * 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):
    car = 40 * days
    if days >= 7:
        car -= 50
    elif days >= 3:
        car -= 20
    return car

def tripcost(city, days):
    return rental_car_cost(days) + hotel_cost(days) + plane_ride_cost(city)

print tripcost("Los Angeles",9)