# Issue with spending money

#1

def hotel_cost(nights):
return nights * 140

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

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

trip_cost(‘Tampa’, 8, 0) returned 1470 instead of the correct value 1610

The code I wrote worked fine in the previous lesson. After I tried adding the argument spending_money to the equation, I got this issue.

#2

If you don’t subtract 1 from days, the test calculation returns 1610.

#3

Yeah I got the same error. But mtf’s solution works… But it’s silly as the exercise before this one makes you add “- days”.

#4

Do you have a link to that exercise so we can check it out?

#5

@mtf

hi, experienced the same. By removing the subtraction of one day from the previous exercise it worked.