Need help with "Plan our trip"


ef 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:
    elif days >= 3:
    return cost
def money(spending_money):
    return spending_money
def trip_cost(Los Angeles, 5, 600):
    return rental_car_cost(days)+hotel_cost(days)+plane_ride_cost(city)+money(spending_money).



def trip_cost(Los Angeles, 5, 600):

why did you change your function parameters?

Change your parameters back the way they used to be, add a function call and supply the arguments to satisfy your function parameters

if the instructions say:

After your previous code

modifying your existing code isn't a good idea :wink:


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

print trip_cost("Los Angles", 5, 600)

okay, but now error is
Traceback (most recent call last):
File "python", line 28, in
File "python", line 26, in trip_cost
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'


if you misspell Los Angeles at function call, plane_ride_cost will return None (the default), then integer + None = error, as you experienced


Thank-you so much, it was really helpful.