Hey, you never know!


#1



https://www.codecademy.com/courses/python-beginner-P5YtY/1/5?curriculum_id=4f89dab3d788890003000096

So basically, when I run my code, it gives me an error message:
Oops, try again.
trip_cost('Los Angeles', 6, 0) raised an error: 'int' object is not callable


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


#2

I also tried changing total cost to trip cost but it didn't work.


#3

Hi this line

total_cost = rental_car_cost(days) + plane_ride_cost(city) + hotel_cost(days) + spending_money(spending_money)

spending_money isn't a function so you should only add it to the other function like that

total_cost = rental_car_cost(days) + plane_ride_cost(city) + hotel_cost(days) + spending_money

#4

It doesn't work. It says that trip cost should take only 2 arguments.


#5

Can you post your new code?


#6

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


#7

oops it didn't indent on there but pretend it did


#8

This line

def trip_cost(city, days):

you shoul add spending_money inside () just after days


#9

Thanks, it really works!