Getting There (What is wrong with my code?)


#1



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


Did you create a function called plane_ride_cost? (P.S. I did create a function!)


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"


#2

Hi @cunycodemaster2k4,

This function header is indented, but should not be ...

    def plane_ride_cost(city):

#3

I typed this code, I didn't indent it:

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 "475"

It still didn't work!


#5

The other problem is that you have quotes around all the numbers in the plane_ride_cost function, for example ...

    return "183"

The quotes make them into strings, and they should be removed.


#7

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