Pull It Together (nights undefined problem)


#1



Taking a Vaction -
Pull it Together


hotel_cost(1) raised an error: global name 'nights' is not defined

Did I miss somethIng here???

`def hotel_cost(days):
return 140*nights

def plane_ride_cost(city) :
if city == "Charlotte" :
return 183*nights
elif city == "Tampa" :
return 220*nights
elif city == "Pittsburg" :
return 222*nights
elif city == "Los Angeles" :
return 475*nights
else :
print "City entered not found"

def rental_car_cost(days) :
cost = 40
if days >= 7 :
return (days * cost) - 50
elif days >= 3 :
return (days * cost) - 20
else :
return days * cost

def trip_cost(city, days) :
a = rental_car_cost(days)
b = hotel_cost(days)
c = plane_ride_cost(city)
return a + b + c


#2

hotel_cost should have nights as parameter when you define the function? it currently has days


#3

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