# 5.Pull it Togheter

#1

I´m trying to do this lesson when the mensage comes out:

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

I alredy know the error is in the calling of trip_cost( days , city)

but you know why i had to pass the string argument first?
It´s always like that when i will pass one function for another function?

``````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:
cost = cost - 50
return cost
elif days >= 3:
cost = cost - 20
return cost
else:
return cost

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

#2

You don't have to consider types when you pick an order for your parameters, no. When codecademy calls your function it provides the city as the first argument, and the number of days as the second.

#3

I do not know why my code is given this error:
"""Oops, try again. hotel_cost(1) raised an error: maximum recursion depth exceeded"""

def hotel_cost(nights):
if nights == 10:
print 140 * 10
return hotel_cost(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):
rental_car_cost = 40 * days
if days >= 7:
rental_car_cost -= 50
elif days >= 3:
rental_car_cost -= 20
return rental_car_cost

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

#4

I don't think you need to input any numbers for hotel_cost(nights):

Rather, I guess you just need to state the relationship between the cost per night and the number of nights in total, I think that may be the source of your error.

#5

I get the exact same error message, but I didn't input a number, just "return 140 * nights" and it worked fine. my trip_cost code looks the exact same, I've double checked for errors. I have no idea what's wrong

#6

Thanks

Ustinovk Freites