Please tell me what went wrong


#1

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

def rental_car_cost(days):
cost = days * 40
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(spending_money)


Whenever I run it, this pops up:
Oops, try again. trip_cost('Charlotte', 3, 0) raised an error: 'int' object is not callable`indent preformatted text by 4 spaces


#2

Hi, @saluszavalia ,

Because your code is not formatted, it is difficult for other users to read and debug it. After code is been pasted into the editing window for posting, you can format it by selecting it, and then by clicking the </> button above the editing area. This will enable us to see important details, such as the indentation and underscores.

You have ...

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

At the end of that statement, the expression, spending_money(spending_money) has the syntax of a function call, as if spending_money were the name of a function. But spending_money actually is used to represent an int when Codecademy tests it, and that's why your code raised an error.

Do this instead ...

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

#3

thank you soo much, sorry for not putting the </>