Getting There


#1



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


Oops, try again. It looks like plane_ride_cost does not return 220 when the city is Tampa.


I am trying to figure out what I am missing here for Tampa to return 220.
I am sure it is something easy I missed, but I cannot figure this out.


Replace this line with your code. 
def plan_ride_cost(city):
    if "Charlotte":
        return 183
    elif "Tampa":
        return 220
    elif "Pittsburgh":
        return 222
    elif "Los Angeles":
        return 475


#2

Looks like your forgetting to do what the example shows for this lesson with the parameter in your def. It uses fruit but for you it will be city.

def fruit_color(fruit):
    if fruit == "apple":
        return "red"
    elif fruit == "banana":
        return "yellow"
    elif fruit == "pear":
        return "green"

Compare the two codes and I think what you left out will become obvious


#3

I tried adding this, but I an still recieving the same error.

def hotel_cost(nights):
return (140 * nights)
def plan_ride_cost(city):
if city == "Charlotte":
return 183
elif city == "Tampa":
return 220
elif city == "Pittsburgh":
return 222
elif city == "Los Angeles":
return 475


#4

Ok I will copy and paste your code into my lesson browser and work on it there. Just give me a minute :sunglasses:


#5

Thank you for your help!


#6

Ok so I just got finished pasting your code into my browser and looking for it. Assuming your code is formatted correctly and not as you have pasted it in the lesson your code should work. It is correct so try refreshing your browser or changing internet browsers to see if it will take it then. Sometimes it just bugs out for whatever the reason even though your code is correct.


#7

Perfect, I refreshed the browser and it worked!


#8

Good! Glad it worked out so nicely for ya! Hope the rest of your lessons go even better! :smiley:


#9

The correct syntax is def planE_ride_cost(city): - you were missing an e, you wrote plan_ride_cost(city):


#10

Good catch! Didn't even notice that earlier.


#12

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.