#1

def hotel_cost(nights):
return hotel_cost (140 * nights)

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

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

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

None

Save & Submit Code
Reset Code
Oops, try again. hotel_cost(1) raised an error: maximum recursion depth exceeded

#2

Hi,

Here you call hotel_cost() inside of the definition of hotel_cost().

Now `hotel_cost(1)` will return `hotel_cost(140 *1)`, and `hotel_cost(140 *1)` will `return hotel_cost(140 *hotel_cost(140 *1))` and so on, until at some point (the maximum recursion depth) Python will stop hotel_cost() from calling itself.

What you need to do is just `return 140 * nights`.