You never know


#1

Hello Friends,

I still didn't get the solution could you please help me with my code ?

def hotel_cost(nights):
# If the hotel costs $140/night...
    return 140 * nights
def plane_ride_cost(city):
# Statements below provide cost of plane ticket for 4 different cities
    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):
# Statements below provide cost of rental car per day with 7 and 3-day discounts
    car_cost = 40 * days
    if days >= 7:
        car_cost -= 50
        return car_cost
    elif days >= 3:
        car_cost -= 20
        return car_cost
    elif days < 3:
        return car_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", 4)

Taking a vacation: Hey, You never know. :( HELP MEE
#2

did you read the answers in this topic? They contain some valuable clues.

here:

    return hotel_cost(days) + plane_ride_cost(city) + rental_car_cost(days) + spending_money()

print trip_cost("Los Angeles", 4)

spending_money is just the function parameter, it is not a function call, remove the parentheses. (you could have gotten that from the answers in this topic)

when you call your function, you don't supply the spending money


#3

i tried with this code : `def trip_cost(city, days, spending_money):
return hotel_cost(days) + plane_ride_cost(city) + rental_car_cost(days)

print trip_cost("Charlotte", 1, 27)`

Still i am getting error :frowning:


#4

Hey i got it now :slight_smile:
its working for me now
Thanks !


#5