# trip_cost('Los Angeles', 5) raised an error: 'int' object is not iterable

#1

trip_cost('Charlotte', 1) raised an error: 'int' object is not iterable

This is supposed to return the sum of all three prices added together. Instead, it's like plane_ride_cost isn't being run at all, and instead it just returns a city name instead of the plane cost.

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

def plane_ride_cost (city):

if city == "Charlotte":
return 183
if city == "Tampa":
return 220
if city == "Pittsburgh":
return 222
if city == "Los Angeles":
return 475

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

return rent

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

#2

HI the sum() work only with itrable object like a list..
that why you have that error

trip_cost('Charlotte', 1) raised an error: 'int' object is not iterable

``````#this a list
li_st = [1 , 2, 3, 5]

print sum(li_st)

#output
11``````

in your case this

``sum (hotel_cost(days) + rental_car_cost(days) + plane_ride_cost(city))``

just add the [] like that

``sum([...])``

#3

Thanks, but I actually found out that I should have just used 'return' instead of 'sum'. But still, thanks for the help!