Taking a vacation 5. Pull it together


#1

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/courses/python-beginner-P5YtY/1/4?curriculum_id=4f89dab3d788890003000096#
<In what way does your code behave incorrectly? Include ALL error messages.>
trip_cost(‘Los Angeles’, 7) returned None instead of the correct value 1685
<What do you expect to happen instead?>
How do I correct my code? I’m not sure where the problem is and I have been working on it for a while.

```python

def hotel_cost(nights):
hotel_cost = 140 * nights
return hotel_cost
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
return city
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):
total = rental_car_cost(days) + hotel_cost(days) + plane_ride_cost(city)

<do not remove the three backticks above>

#2

your trip_cost function stores the result in a variable total. The hint is in the error message:
trip_cost(‘Los Angeles’, 7) returned None instead of the correct value 1685

Let me highlight that for you. Returned, your function doesn’t return anything, use the return keyword


#3

thank you for your help. such an obvious mistake. I’ve got it now