Hey, You Never Know!


def hotel_cost(nights):
    hotel_cost = 140 * 2
    return 140 * nights
def plane_ride_cost(city):
    if city == "Charlotte":
        return 183
    if city == "Tampa":
        return 220
    if city == "Pittsburgh":
        return 222
    if city == "Los Angeles":
        return 475
def rental_car_cost(days):
    cost = 40 * days
    if days >= 7:
        return cost - 50
    elif days >=  3:
        return cost - 20
    return cost
def trip_cost(city, days, Spending_money):
     return plane_ride_cost(city) + hotel_cost(days) + rental_car_cost(days) + spending_money

hi i was trying this program bu there was an error. when i click on save&submit it was showing like this.

Oops, try again. trip_cost('Charlotte', 2, 0) raised an error: unsupported operand type(s) for +: 'int' and 'function'

could any one helps me to solve this program.


I think it is because your S is capitalized when it should be just spending_money rather than Spending_money. I got the same type of error at least when I capitalized the S in spending in my code.


kk. could you tell me weather i wrote my program in correct way.


Well first, did that fix your error? Second, if not, post your code again and we can work through it. Third, if it passes the lesson you have written it right :smiley: I know that is obvious but I don't know what else you mean by that.


kk. well as your advice i had written small spending_money my program get correct.


Good! Glad to help! If you need anything else or more explanation just chat me!


kk. i will contact you. thank you