Pull it together


def hotel_cost(nights):
return hotel_cost(140 * nights)
def plane_ride_cost(city):
if city == "Charlotte":
return 183
if city == "Tampa":
return 220
if city == "Pittsburgh":
return 222
if city == "Los Angeles":
return 475
def rental_car_cost(days):
cost = days * 40
if days >= 7:
cost = cost - 50
elif days >= 3:
cost = cost - 20
return cost
def trip_cost(city, days):
return rental_car_cost(days) + hotel_cost(days) + plane_ride_cost(city)

this is my code, and the program says "Oops, try again. hotel_cost(1) raised an error: maximum recursion depth exceeded" i don't have idea what should i do. Please help me! thank you


You're calling same function inside the body of it,that creates this bug.

here just return 140*nights?

also make sure that you have proper indentation.


it worked, thank you very much :slight_smile:


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