Plan your trip!


I'm receiving a TypeError: unsupported operand type(s) for +: "Nonetype" and "int".

I've tested this on my computer using python 2.7 and 3.5; 3.5 executes the code just fine and returns expected answer; 2.7 does not. Here in the exercise, I'm doing exactly what the hint shows, yet it errors and I've tried several variations.

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 = 40 * days
    if days >= 7:
        cost = cost - 50
    elif days >= 3:
        cost = 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
print (trip_cost("Los Angelas", 5, 600)) # I've tried this line with and without the first set of parenthesis (enclosing trip_cost)


your function call:

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

you misspelled Los Angeles, which means this condition:

elif city == "Los Angeles":

is false, so your function returns None (the default) instead of 475


Holy crap, I must of looked right over that 20 times. Even funnier is I typed it correctly on my desktop when I was testing.

Thank you very much.