Plan your trip


#1

def hotel_cost(nights):
    return 140 * nights
def plane_ride_cost(days):
    if city == "Charlotte":
        return 183
    if city == "Tampa":
        return 220
    if city == "Pittsburgh":
        return 222
    if city == "Los Angeles":
        return 475
def rental_car_cost(days):
    rent_cost = 40 * days
    if days >= 7:
        return rent_cost - 50
    elif days >=3:
        return rent_cost - 20
    else: 
        return rent_cost
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)

Oops, try again. Oops! Did you accidentally delete the trip_cost function?
I dont get what I'm doing wrong!
Can somebody explain me what I'm doing wrong?
Thanks in advance!


#2

That error message is questioning the existence of a function of yours, seems like the first thing you might want to check out is whether you're able to use that function - test it


#3

I found 1 thing I did wrong! I accidentally wrote days instead of city when i was testing things, so stupid

def plane_ride_cost(days): #this was wrong
def plane_ride_cost(city): #this is correct

but now i receive this error message:

Oops, try again. It looks like nothing was printed to the console!


#4

Nevermind i fixed it!

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)

#5

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