Need help----Hey, you never know


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

yea, here:


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


'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.


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


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.


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


OK. I see. Thank you for informing.


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