Taking a Vacation


#1


"Oops, try again. trip_cost should take exactly three parameters: city, days, and spending_money (in that order)."


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):
    price = days * 40
    if days >= 7:
        price -= 50
    elif days >= 3:
        price -= 20
        return price
    
def trip_cost(city, days, spending_money):
    
    return rental_car_cost(days) + hotel_cost(days) + plane_ride_cost(city) + spending_money

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


#2

i think you are doing lesson 7(Plan Your Trip!)

isn't there a function named extra_cost ??

click on reset button you'll see it . now inside the trip_cost function you have to call the function .

extra_cost(spending_money)


#3

No, there is not a function named extra_cost. The extra cost, spending_money is tacked on at the end of trip_cost return value.


#4

Hi, @andrew_332 ,

@mtf is correct. You should not create an extra_cost function.

Is your rental_car_cost function written correctly? What does it return if days is less than 3 or greater than or equal to 7?


#5

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