Plan your Trip! Final step, help


I've gone through my code several times and I believe it "works" as the answer it prints is 1955, but I keep getting this error: "Oops, try again. trip_cost should take exactly three parameters: city, days, and spending_money (in that order)." How do I fix this?

def hotel_cost(days):
    return 140 * days

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 rentalcarcost(days):
    rent = days * 40
    if days >= 7:
        rent -= 50
    elif days >= 3:
        rent -= 20
        return rent

def trip_cost(city, days, spending_money):
    return plane_ride_cost(city) + hotel_cost(days) + rentalcarcost(days) + spending_money

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


Your function name is rental_car_cost not rentalcarcost.

Actually, I realized you have defined it as rentalcarcost my bad.

Check your rentalcarcost function. You're not really returning rent properly. Make sure your return statement lines up with your elif statement.


Yeah, had to tweak different things to see if it worked that way. But after aligning the return statement with my elif statement it finally worked without any errors.



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