#1

## what's wrong with my code?

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):
cost = 40*days
if days >= 7:
return cost - 50
elif days >= 3:
return cost - 20
else:
return cost
def trip_cost(city,days,spending_money):
return rental_car_cost(days) + hotel_cost(days) + plane_ride_cost + spending_money

#2

i have the same problem

#3

In the above return statement, you have mentioned plane_ride-cost as a variable,but it actually is a function which should be mention with open and close braces with a string parameter as below

return rental_car_cost(days) + hotel_cost(days) + plane_ride_cost("Tampa") + spending_money

#4

Hi @samauden,

Actually, if you do this, the `trip_cost` function will only work correctly when you go to `"Tampa"` ...

``return rental_car_cost(days) + hotel_cost(days) + plane_ride_cost("Tampa") + spending_money``

To make it work for any of the cities, do it this way ...

``return rental_car_cost(days) + hotel_cost(days) + plane_ride_cost(city) + spending_money``

#5

Ok. I agree. I have completed the that exercise by passing "City" only.

#6

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

this worked for me

#7

can someone plz post the answer

#8

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

#9

I found 3 problems within your code,
1. Indentation
2. In your "rental_car_cost" def, return parts, basic operator should be like this `-=` instead of `-`
3. As others stated, `plane_ride_cost`, in your last line should be like this: `plane_ride_cost(city)`

To have a result. you can add this like as well, without any indentation:
`print trip_cost("Tampa", 13, 75)`

So your final code would look like this:

``````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(city, days, spending_money):
return (rental_car_cost(days)+hotel_cost(days)+plane_ride_cost(city)+spending_money)
print trip_cost("Tampa", 13, 75)``````

#10

It took me a while but this code worked for me:
def hotel_cost(nights):
#Costs 140 per night
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):
total = days * 40

``````if days >= 7:

elif days >= 3:

elif days < 3:

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