Having Trouble with 7: Planning a Trip


#1

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

It said this:
nothing was printed into the console

I expected to finish it



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
def rental_car_cost(days):
    if days < 3:
        return 40 * days
    elif days > 6:
        return 40 * days - 50
    else:
        return 40 * days - 20
def trip_cost(city,days, spending_money):
    return rental_car_cost(days) + hotel_cost(days) + plane_ride_cost(city) + spending_money
    def trip_cost(city, days, money):
        print trip_cost("Los Angeles", 5,600)



#2

why did you add another trip_cost function:

def trip_cost(city, days, money):

?

the function call:

print trip_cost("Los Angeles", 5,600)

executes the function, so it should be placed outside/after the function, not in the body of the function


#3

Oh thanks for the help


#4

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