Plan you trip. please help


#1

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

The code should print out the total cost of the trip, and it seems like it does. But for some reason
i am not able to get to the next level/lesson. I

def hotel_cost(nights):
    return 140 * nights
f1 = hotel_cost

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
f2 = plane_ride_cost

def rental_car_cost(days):
    if days >= 7:
        return days*40-50
    elif days >= 3:
        return days*40-20
f3 = rental_car_cost

def trip_cost(city,days,spending_money):
    return +f1(days)+f3(days)+f2(city)+spending_money


    


print trip_cost(city = "Los Angeles", days = 5, spending_money = 600)

#2

Hi, @javacoder13705 ,

Codecademy's message is misleading concerning the actual problem.

What should the rental_car_cost function return when the car is rented for fewer than 3 days?

While it does not cause a problem regarding the outcome, why did you establish aliases for several of the function names?


#3

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