"Getting there"


#1

Link to the course:
https://www.codecademy.com/courses/python-beginner-P5YtY/1/2?curriculum_id=4f89dab3d788890003000096#

It gave me this error:
Oops, try again. Did you create a function called plane_ride_cost
Even though i created the function, what should i do?

This is my code:
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

Thank you


#2

Notice that there's a syntax error reported in the console? That's the first thing to consider because if your syntax is invalid it won't run.


#3

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 this one.
you should put an ":" after each elif or if function .


#4

Thank you! Haha i don't belive it's just that small mistake! I've been trapped for hours


#5

you welcome ! here whenever you need !


#6

This is my code:
def hotel_cost(nights):
return 140 * nights
def plane_ride_cost(city):
if city == "Charlotte":
return 183
elif city == "Tampa":
return 220
elif city == "Pittsburg":
return 222
elif city == "Los Angeles":
return 475
But it dont work.
What I see:
Oops, try again. It looks like plane_ride_cost does not return 222 when the city is Pittsburgh.
Why?


#7

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 this


#8

https://www.codecademy.com/courses/python-beginner-P5YtY/1/2?curriculum_id=4f89dab3d788890003000096#

^Where is the indent problem here?


#9

A post was split to a new topic: Getting there


#10