5. Pull It All Together


#1

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

I'm getting this error: Oops, try again. trip_cost('Los Angeles', 5) returned None instead of the correct value 1355. This error will jump from city to day and keep giving me the same error...sometimes it says "False" where it shows "None"


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
    else:
        return "Enter City Again"

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(city, days):
    trip_cost = hotel_cost(days)+plane_ride_cost(city)+rental_car_cost(days)


#2

You forgot to return your trip_cost function.


#5

On the very last line

replace trip_cost = because the equation you've created will produce that already
And remember to return your answer


#6

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