Pull it Together Help


#1

I'm having trouble with Pull it Together and have been trying to figure out what it is but whatever I try doesn't help and I can't see anything wrong with what I typed.

I keep receiving the following message:
hotel_cost(1) raised an error: maximum recursion depth exceeded

The code:

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

#2

please post your full code, the error message seems to indicate there is a problem in your hotel cost function


#3

There shouldn't be a problem above because I didn't touch anything and it was fine before this step.

the code is:


#4

well, your hotel_cost function has a recursion problem. Its sort of like an infinity loop, but then with functions.

line 2, return the cost (nights * 140) but without calling the function inside the function


#5

do you mean I should type:

return 140*nights ?

ok, I tried it, it works. Thank you..

How come this error didn't pop up earlier? Everything worked fine until this step which is why I was so confused.


#6

i don't know why the error didn't pop up earlier. Most important is that we sort the issue :slight_smile:


#8

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