# Final value shows okay but mistake is appear

#1

Hello eceryone!
in right console I see my code is counting right, but some mistake apper and shows that function plane_ride_cost(city) return wrong value! Please see my code:

def hotel_cost(night):
return 140*night
trip = 5
hotel_cost(trip)
print (hotel_cost(trip))

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)
city = "Pittsburgh"
plane_ride_cost(city)
print (plane_ride_cost(city))

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

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

Oops, try again. trip_cost('Pittsburgh', 2) returned 1002 instead of the correct value 582

Function does not return correctly

``````def hotel_cost(night):
return 140*night
trip = 5
hotel_cost(trip)
print (hotel_cost(trip))

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)
city = "Pittsburgh"
plane_ride_cost(city)
print (plane_ride_cost(city))

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

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

# Thank you very much for helping!``````

#2

In the `trip_cost` function you have:

``hotel_cost(trip)``

`trip` is a global variable with value `5`. So if you are not going on the five-day trip the result will be incorrect. You should use here value of parameter `days`:

``hotel_cost(days)``

#3