# I have an error... please assist me in my crisis

#1

here is my code:

``````    return 140 * nights

def plane_ride_cost(city):
if plane_ride_cost("Charlotte"):
return 183

if plane_ride_cost("Tampa"):
return 220

if plane_ride_cost("Pittsburgh"):
return 222

if plane_ride_cost("Los Angeles"):
return 475

def rental_car_cost(days):
rent = 40 * days

if days >= 1:
rent >= 40

if days >= 7:
rent -= 50

elif days >= 3:
rent -= 20

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

every time I try to modify to how I think that it needs to be modified to, it tells me that for "plane_ride_cost('Charlotte')", the recursion depth has been exceeded... so some assistance with this would be a huge help to me.

#2

On this block.

``````def plane_ride_cost(city):
if plane_ride_cost("Charlotte"):
return 183

if plane_ride_cost("Tampa"):
return 220

if plane_ride_cost("Pittsburgh"):
return 222

if plane_ride_cost("Los Angeles"):
return 475``````

Try to use if...elif...else. Heres the right syntax:

``````if expression1:
statement(s)
elif expression2:
statement(s)
elif expression3:
statement(s)
else:
statement(s)``````

Heres the example for your better understanding:

``````def alphabet(letter):
if letter == "a":
return 1
elif letter == "b":
return 2
elif letter == "c":
return 3
else:
return 123``````

Hope this helps

#3

def hotel_cost(nights):
return 140 * nights

def plane_ride_cost(city):
if plane_ride_cost == "Charlotte":
return 183

``````elif plane_ride_cost == "Tampa":
return 220

elif plane_ride_cost == "Pittsburgh":
return 222

else:
plane_ride_cost == "Los Angeles":
return 475``````

i tried this method of coding, but i spits back the error that "charlotte" keeps returning 475 instead of 183...

#4

Use same method on this part

Like this:

``````def plane_ride_cost(city):
if city == "Charlotte":
return 183``````

and so on....... Just continue the code above(if, elif, else for plane_ride_cost(city))