# Code not working

#1

Exercise that I am stuck at.>

plane_ride_cost('Charlotte') raised an error: maximum recursion depth exceeded in cmp

To run

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

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

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

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

#2

the error message is caused by this line:

``return plane_ride_cost(city)``

you return the function call, which means it will get in a sort of endless loop, endless keep calling the function (aka itself)

You might want to return the amount of money instead

#3

error: trip_cost('Charlotte', 9) raised an error: cannot concatenate 'str' and 'NoneType' object

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

#4

the exercise is going to call trip_cost multiply times, so i would swap the function arguments (days and city), since a function call by the exercise will city (for example: Los Angeles) as first parameter, and days as second parameter.

Inside your trip_cost function, you can't call plane_ride_cost and rental_car_cost with parameters, look at the function declaration of both, they have arguments, you need to supply these when you call the function

#5

See anything odd here? Read it out loud.

``trip_cost(days='Charlotte', city=9)``