# Pull it Together returns to non-number value

#1

[ Pull it Together ] has given me a hard time i dont know how to do this if possible explain to me why my code doesnt work at least show me your working code so i can compare with mine

Oops, try again. trip_cost('Tampa', 6) returned ('TampaTampa', 6) instead of the correct value 1280

i expect to give me a number instead of TampaTampa

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

return cost

def trip_cost(days, city):
return days + days, city``````

#2

from the instructions:

Like the example above, have your function return the sum of calling the rental_car_cost(days), hotel_cost(days), and plane_ride_cost(city) function

you return the sum of days, days and city. That is quit difference

#3

How should i do it can i copy from your code please ?

#4

How do you think it should be done?

No, asking for code and posting code answers is violating the guidelines

#5

Really ? okay from my perspective my code is ok .But something doesnt match and i don`t know where or how should it

#6

which is here:

``return days + days, city``

while the instructions tell you to: return the sum of calling the rental_car_cost(days), hotel_cost(days), and plane_ride_cost(city) function

quit a difference, no?

#7

return
rental_car_cost(days) + plane_ride_cost(city) + hotel_cost(nights)

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

#8

So indent will show on the forum

#9

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

return cost

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

#10

here:

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

where does `nights` come from? Is that variable within the variable scope? What alternatives do you have? If i look at the instructions:

``hotel_cost(days)``

i don't see a different argument used

#11

I´ve changed the nights in the hotel cost for days since its the same amount and i got this errror now

Oops, try again. trip_cost('Los Angeles', 7) raised an error: unsupported operand type(s) for -=: 'str' and 'int'

i have really tried figuring this out for long time now but i get the same error i watched other tickets on the Q and A Forum but none of them work , i am sick of turning this computer on and on and getting nowhere i dont want to learn a diferent language i want an answer that can fix my problem

#12

can i see an updated version of your code? Otherwise i have to guess what you did

#13

It its literally the same code with days instead of nights in the hotel_cost

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

return cost

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

#14

I wanted to be sure of the changes you made, i have had miscommunication because of this in the past.

okay, so the exercise calls the function to validate your code works correctly, for example:

``trip_cost('Charlotte', 0)``

see how the city is the first argument, and the days the second argument.

Now look at your function, `days` is the first parameter, so days will contain `Charlotte` and city will contain 0. Swap your parameters

#15

OMG it just work finally i am free !!!!

You have so much patience with me how can i thank you to let others know you are the best ??

#16