# Could somebody explain what im doing wrong Did you create a function called plane_ride_cost?

def hotel_cost(nights):
return 140 * nights

``````def plane_ride_cost(city):
if city == "Charlotte":
plane = 183
return (city)``````
``````city = raw_input("Where will you be going?")
def hotel_cost(nights):
return 140 * nights

def plane_ride_cost(city):
if city == "Charlotte":
cost = 183
return cost
elif city == "Tampa":
cost = 220
return cost
elif city == "Pittsburgh":
cost = 222
return cost
elif city == "Los Angeles":
cost = 475
return cost
else:
return "Not a valid destination."
``````

I GOT this somebody any suggestion on what i did wrong?

your plane_ride_cost function is inside your hotel_cost function, the plane ride cost function should be outside/after the hotel_cost function (hint: indention)

also, this:

``````return "Not a valid destination."
``````

is risky, the code you will build later will expect a integer result from plane ride cost function. Keep this is mind. You can leave the code, but be aware of this problem

oh so the code was good but the (hint: indention) was bad could you maybe explain it a litte more so that i understand how to use it

well, at this point in the course i assume you know how to use indention to determine what is inside/outside a function

Yeah i know what you mean but the problem is. I think i know how to do it. but dont really understand what it do? do you understand that. I like to understand what im doing already looking on the internet but still not sure. Thats why im asking you. Hope that you can help me understand phython

well, you could simply place the plane_ride_cost function outside the hotel_cost function by giving plane ride cost an indention of 0 spaces, anything which has lesser indent then the function is outside the function

``````city = raw_input("Where will you be going?")
def hotel_cost(nights):
return 140 * nights

def plane_ride_cost(city):
if city == "Charlotte":
cost = 183
return cost
elif city == "Tampa":
cost = 220
return cost
elif city == "Pittsburgh":
cost = 222
return cost
elif city == "Los Angeles":
cost = 475
return cost
``````

So every function needs zero space’s so that python see its a new function it works like that ?

yes and no, the incorrect code you had first you nested the plane_ride_cost function inside hotel_cost function, which is valid (you can nest functions), but the exercise wants you create a bunch of separate functions, not nested functions

there are two things at play here: valid syntax and design of your program

i understand. if its not hard could you show one thats nested and one that is seperated if its not a problem for you. Than i think i really understand it

No, you don’t understand. If you did, you wouldn’t ask this. You first had a nested function:

``````city = raw_input("Where will you be going?")
def hotel_cost(nights):
return 140 * nights

def plane_ride_cost(city):
if city == "Charlotte":
cost = 183
return cost
elif city == "Tampa":
cost = 220
return cost
elif city == "Pittsburgh":
cost = 222
return cost
elif city == "Los Angeles":
cost = 475
return cost
else:
return "Not a valid destination."
``````

and then you correct it to separate functions:

``````city = raw_input("Where will you be going?")
def hotel_cost(nights):
return 140 * nights

def plane_ride_cost(city):
if city == "Charlotte":
cost = 183
return cost
elif city == "Tampa":
cost = 220
return cost
elif city == "Pittsburgh":
cost = 222
return cost
elif city == "Los Angeles":
cost = 475
return cost
``````

I think i got it thanks for youre time men:)

city = raw_input(“Where will you be going?”)
def hotel_cost(nights):
return 140 * nights

def plane_ride_cost(city):
if city == “Charlotte”:
cost = 183
return cost
elif city == “Tampa”:
cost = 220
return cost
elif city == “Pittsburgh”:
cost = 222
return cost
elif city == “Los Angeles”:
cost = 475
return cost

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