4/7 "Pull it Together" I need help


#1

https://www.codecademy.com/en/courses/python-beginner-P5YtY/1/4?curriculum_id=4f89dab3d788890003000096

I got this error message: "Oops, try again. plane_ride_cost('Charlotte') raised an error: maximum recursion depth exceeded while calling a Python object". I don't know what that error message means at all.

I was expecting this to work because that code is directly from a previous part.

def hotel_cost(nights):
    return 140*nights
    

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

#2

The above is not requested or expected, and it wipes out the parameter. Best to remove that line.

The above line should not be inside the function.


#4

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