Pull it together


#1

I m getting error in following code. please help. Error message is "Oops, try again. trip_cost('Pittsburgh', 7) raised an error: global name 'hostel_cost' is not defined"
CODE
def hotel_cost(days):
hotel_cost = 140 * days
return hotel_cost

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_costs = days * 40

if days >= 7:
   car_costs = car_costs - 50
   return car_costs
elif days >= 3:
    car_costs = car_costs - 20
    return car_costs 
else: 
    return car_costs

def trip_cost(city, days):
return rental_car_cost(days) + plane_ride_cost(city) + hostel_cost(days)


#2

here:

return rental_car_cost(days) + plane_ride_cost(city) + hostel_cost(days)

you misspelled hotel, we are traveling expensive (hotel) not cheap (hostel) :stuck_out_tongue:


#3

Misspelling..
Its hotel_cost()


#4

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