Python taking a vacation ( Pull it together) HELP


#1



I'm having issues with the "maximum recursion depth exceeded in cmp" i have attatched an image so everyone has a clear idea on what i'm talking about.





Edit: i also ran this code in atom.io and it runs fine in there.
Code:

def hotel_cost(nights):
    return 140*(nights)
    
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
    return plane_ride_cost(city)
    
def rental_car_cost(days):
    car_rental = 40 * days
    ##car == 40* days ($40 a day)
    if days >=7:
        car_rental -=50
    elif days >= 3:
        car_rental -=20
    return car_rental

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


#2

Could you post your code instead of a screenshot, so we are able to test it.


#3

Okay, I have posted the code as requested.


#4

You are calling hotel_cost with wrong parameter. Have a little look at it.


#5

If you're implying that i've labeled it "nights" instead of days it doesn't matter both, have the same re-curve error.


#6

Haha now I got it. Your problem is not in this part of the code. Look at your function called plane_ride_cost ;
Names of the cities must begin with a capital letter.


#7

Oh shoot, your right, to be honest this should have been picked up ages ago so this error does'nt occur.
Thank-you so much for the help @papusalaatti !


#8

No problem, Adam. :slight_smile: I just don't understand how you passed the earlier exersice if your letters were not capital.


#9

I really don't know but I am going to submit a ticket to the developers so they can edit this semi "bug" :slight_smile:
Once again thank you so much for your help.


#10

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