# Correct return values but with error

#1

getting correct values for trip_cost but have error:

Oops, try again. trip_cost('Tampa', 8) raised an error: unsupported operand type(s) for -: 'str' and 'int'

Running the plane_ride_cost() by itself doesn't result in error.
Running trip_cost() with only plane_ride_cost() also doesn't result in error.
Error only appears if I run trip_cost() together with all the other function

can anyone explain the error?

``````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
else:
return "xxxxxx"

def rental_car_cost(days):
cost = 40 * days
if days >= 7:
return cost - 50
elif days >= 3 and days < 7:
return cost - 20
else:
return cost

def trip_cost(a, b):
return hotel_cost(a) + plane_ride_cost(b) + rental_car_cost(a)

print trip_cost(1, "Charlotte")``````

#2

look:

``Oops, try again. trip_cost('Tampa', 8)``

city is the fist argument, and days the second argument. But your parameters (a and b) are the other way around

#3

my argument is (a, b)
a for days
b for city

trip_cost(1, "Charlotte")

hotel_cost(a) + plane_ride_cost(b) + rental_car_cost(a)

Also... error messages specifically the "city" changes even without me changing anything in the code

Thanks

#4

yes, but the exercise will give the city as first argument:

``trip_cost("Charlotte", 1)``

so now `a` contains the city, where as `b` contains the days.

So, `a` is the city, `b` is the number of days. Use them as such, not the other way around

#5

ok! got it... city should be the first argument. Thanks!!!

#6