Need help----Hey, you never know


#1



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


error message shows:
Oops, try again. trip_cost('Los Angeles', 0, 0) raised an error: 'int' object is not callable


what's wrong with my code? I think the problem must included in the last line of code.


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


Trouble Printing code
#2

yea, here:

spending_money()

spending_money is not a function call? its just a value, remove the parentheses


#3

'spending_money' is just an argument, so I think the parenthese is not suitable in last line.
But this is also wrong without a parenthese.
I am looking for help, too.


#4

if you are also looking for help, make a new topic, otherwise this topic becomes a clutter


#5

I removed it.
The code is as follows:
def trip_cost(days,city,spending_money):
return hotel_cost(days)+plane_ride_cost(city)+rental_car_cost(days)+spending_money
But it warns me: trip_cost('Charlotte', 6, 0) raised an error: cannot concatenate 'str' and 'NoneType' objects
It's werid.


#6

please go here, press new topic, fill in the template so that we have all the information needed. Also, post your full code.


#7

OK. I see. Thank you for informing.


#8

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