# I Can't 'Pull It Together'!

#1

def hotel_cost(nights):
return hotel_cost(nights) * 140

def plane_ride_cost(city):
if plane_ride_cost(city) == "Charlotte":
return 183
elif plane_ride_cost(city) == "Tampa":
return 220
elif plane_ride_cost(city) == "Pittsburgh":
return 222
else:
return 475

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

def trip_cost(city, days):
return rental_car_cost(days) + hotel_cost(days) + plane_ride_cost(city)
print trip_cost ("Tampa", 5)

This is the code that I'm inputting, but Codecademy returns with "Oops, try again. hotel_cost(1) raised an error: maximum recursion depth exceeded"

#2

Hi here

def hotel_cost(nights):
return hotel_cost(nights) * 140

You should change hotel_cost(nights) by just night like that

return nights * 140

#3

I had issues as well, but here's what works.

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

def trip_cost(city, days):
return sum([rental_car_cost(days), hotel_cost(days), plane_ride_cost(city)])

At first I had issues with sum complaining about 3 arguments vs 2, then I found the following to find the square brackets. I still don't totally understand the 'start/iterable' part, but brackets solved the problem for me. Hope it helps.

http : // stackoverflow.com/questions/17665813/python-i-do-not-understand-the-complete-usage-of-sum

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

thats it