Taking a Vacation - Pull it Together [5]


I'm getting the error:
Oops, try again. plane_ride_cost('Charlotte') raised an error: maximum recursion depth exceeded
I believe I'm just not adding it up properly? Someone please point me in the right direction?

def hotel_cost(nights):
return 140 * nights

def plane_ride_cost(city):

if plane_ride_cost(city) == "Charlotte":
    return 183
elif plane_ride_cost(city) == "Tampa":
    return 220
elif plane_ride_cost(city) == "Pittsburgh":
    return 222
elif plane_ride_cost(city) == "Los Angeles":
    return 475

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

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


The function is called plane_ride_cost to which we pass a city. We would not call the function from inside. Only compare the city to the range of names.

if city ==


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