Indentation error? but i did indent it..?


I simply wanted to add spending costs to my already working code, but i couldn't find the error that's stopping it from working. Help please?

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 = days*40
    if days >= 7:
        return cost-50
    elif days >= 3:
        return cost-20
    return cost

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


The above has no definition. Suggest remove this line.

sholuld be,

+ spending_money

and the parameters would read,

def trip_cost(city,days,spending_money):

The call would include an amount in the third argument.

    print trip_cost("Tampa", 10, 1000)    # 2970


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