Taking a vacation getting there

what’s wrong with my code. Error says I need to define Plane ride cost and syntax on line 7. Any help appreciated.

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”

Hi remove the " " around all your number

tried that still no joy and it’s saying (Oops, try again. Did you create a function called plane_ride_cost? ) can’t see why. ever question seems so hard. Thanks for your help

Hi can you post your new code ? And read this one how to format your code

Here you go.
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

Try to refresh the page.

will tht help tho umm confused … :pensive:

i did but it still dsnt work for me

Hi can you post your code ?
And that topic is from 1 mounth ago… next time is better if you create a new topic.

oh ok…n sorry for the late reply
def hotel_cost(nights):
hotel_cost= 140
return 140 * nights
def plane_ride_cost(city):
if city == “Charlotte”:
return 183
elif city == “Tampa”:
return 220
elif city == “Pittsburgh”
return 222
if city == “Los Angeles”:
return 475

first here

def hotel_cost(nights):
hotel_cost= 140
return 140 * nights

you should remove the hotel_cost= 140

here

elif city == "Pittsburgh"
return 222

its missing the : after "Pittsburgh"
then here

if city == "Los Angeles": 
return 475

It should be elif instead of if

i guess there is something wrong with line 5…n its not working sorry…n i wnt mindif u cnt do it…its ok…i dnt wanna trouble u

but just check if i did it right

your if and elif statement should be indent inside the function like that

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

i will try next time but thnx for the help…coz i needa go
:slight_smile: take care n if it still dsnt work i will ask u

1 Like

lol now it says theres something wrong with line 10

my teacher helped me with it…n i got it right…thnx for ur help…really appreciate it :slight_smile:

1 Like

HI sorry it was the last elif statement which had the wrong indent

..........
    elif city == "Pittsburgh":
        return 222
    elif city == "Los Angeles": 
        return 475

oh its fn dnt worry… n i already did it so it dsnt matter…but thnx anyway :slight_smile:

1 Like