Hey, You Never Know 6/7


#1

I don't know what's wrong with this code or where is the mistake exactly?

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

The error Message says "Oops, try again. trip_cost('Los Angeles', 0, 0) raised an error: 'int' object is not callable"

Can anyone help me, please?
Thanks in advance



#2

here:

spending_money()

you made spending_money into a function call, from the instructions:

Modify what the trip_cost function does. Add the variable spending_money to the sum that it returns

you simply add trip_cost as variable, not as function call


#3

sorry, would you clear more?


#4

test = 50

# adding test to total as function call
# except test is not a function, so will give error
total = total + test()

# adding test to total as variable
total = total + test

#5

ok I got it, thank u


#6