Hi i am confused on planning my trip


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

Traceback (most recent call last):
File "python", line 21, in
NameError: name 'city' is not defined


You should actually pass a value other than the variables.
Your trip_cost call should pass some parameters, such as "Los Angeles", 12, 200, and there you'd be able to see what your function will bring back.

That was just an example, you can try other inputs, unless there's something in the instructions that are telling you to do something and if so, you should follow it.


Thank you I will try this and get back to you.