# Help! get stuck with Plan your trip!

#1

``````def hotel_cost(nights):
#hotel 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):
cost = 40*days
if days>=7:
cost-=50
elif days>=3:
cost-=20
return cost
def trip_cost(city,days,spending_money):
trip_cost=rental_car_cost(days)+ hotel_cost(days) + plane_ride_cost(city)+spending_money
return trip_cost
print trip_cost("Los Angeles",5,600)``````

Help!!!!!
the system keep saying I have a problem of
"trip_cost should take exactly three parameters: city, days, and spending_money (in that order)"
but it seems that I put these three parameters in correct order, doesn't it?
I almost wanna kill myself for stucking in this problem for a long time..............

``Replace this line with your code.``

#2

the trip_cost function call:

``print trip_cost("Los Angeles",5,600)``

should be placed outside/after the function, not be part of the function content

Also, rental_car_cost only returns cost if i rent the car for: 3, 4, ,5 or 6 days. What about 1 and 2 days and longer then one week?

#3

Thank u !
so shall I write the code like this?:

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

#4

that is better already, now you cover 1 and 2 days, but what about 7 days and more?

#5

Hmm... but it is already including [more than 7days], isn't it?
if days>=7:
cost-=50
sorry I didnt get what you mean

#6

yea, true, but if i rent the car for 9 days, none is returned:

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

print rental_car_cost(9)``````

this should return 310, it doesn't. Because a return keyword is not reached, it returns None (the default)

#7

Ahh thank u for helping me notice this problem!!!!!!
so the code should run like this:

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

Thank u so much!

#8