I'm making a model for vacation costs in a code academy exercise, and I have three functions defined so far, rental_car_costs
with the argument days
, hotel_cost
with the argument nights
, and plane_ride_cost
with the argument of city
. The code looks like this:
def hotel_cost(nights):
return hotel_cost(nights)
return 140 * nights
def plane_ride_cost(city):
return plane_ride_cost(city)
if "Charlotte":
return 183
elif "Tampa":
return 220
elif "Pittsburgh":
return 222
elif "Los Angeles":
return 475
def rental_car_cost(days):
rental_car_cost = 40 * days
if days >= 7:
rental_car_cost -= 50
elif days >= 3:
rental_car_cost -= 20
return rental_car_cost
All that works and I have no problem with it, but I want to make a function called trip_cost
, and I keep getting a maximum recursion depth exceeded. The code looks like this
def trip_cost(city, days):
return plane_ride_cost(city) + hotel_costs(days) + rental_car_cost(days)
I pass the value of nights to days, and just in case I've tried substituting nights in anyway, but I still get the exact same error message. What am I doing wrong, and what does maximum depth recursion exceeded mean?