I dot know this code where error, I hope someone can help me check this code,very very thanksI


#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 = 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) + trip_cost(spending_money)

error:
Oops, try again.
trip_cost('Charlotte', 9, 0) raised an error: trip_cost() takes exactly 3 arguments (1 given)


#2

Try this:
def trip_cost(city,days,spending_money):
return rental_car_cost(days) + hotel_cost(days) + plane_ride_cost(city) + spending_money
// changed it from trip_cost(spending_money) to just spending_money


#3

Through your help my problem is resolved, thank you very much! thank you very much!


#4

Hi,
I'm getting this error: trip_cost('Pittsburgh', 8, 0) raised an error: 'int' object is not callable.
I don't understand what that means... This is what I wrote:

def hotel_cost(days):
return 140*days

def plane_ride_cost(city):
if city == str("Charlotte"):
return 183
elif city == str("Tampa"):
return 220
elif city == str("Pittsburgh"):
return 222
elif city == str("Los Angeles"):
return 475

def rental_car_cost(days):
cost = 40*(days)

if days >= 7:
    return cost - 50
elif days >= 3:
    return cost - 20
else:
    return cost

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


#5

Hello camiret, i hope you solved it already :),

The mistake you made is writing spending_money() which python sees as a function. You need to use spending_money without bracklets so python can call an int(integer) number. Basically the problem is () at last line.