'int' object is not callable


#1


I'm stuck at 'Hey, you never know!' and error messages like the one below keep showing up.

"Oops, try again. trip_cost('Tampa', 9, 0) raised an error: 'int' object is not callable"

My code is as follows:


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

def spending_money() :
    return 200

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

Thanks


#2

The above is not a function, but a plain variable (see parameters).


#3

I had the same problem, thank you. I just had to remove the () from spending_money.
Much appreciated.


#4

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