7. Taking A Vacation


#1

Why won't it print the trip cost to the console? :confused:

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 >= 7:
        return 40 * days - 50
    elif days >=3:
        return 40 * days - 20
    else:
        return 40 * days

def trip_cost(city,days,spending_money):
    return hotel_cost(days) + plane_ride_cost(city) + rental_car_cost(days) + spending_money
    print trip_cost("Los Angeles" , 5, 600)

#2

What does the error say?


#3

Nothing was printed to the console.


#4

Why is there "indent preformatted text by 4 spaces"?


#5

Must of messed up when I was trying to format the code for the forum. That's not in the actual code.


#6

Try moving the print statement outside the function.


#7

Can't define arguments inside the function. Got it. Thanks Kogey!


#8

No problem. :sweat_smile: