Help me, im stuck


#1



3. Getting There

File "python", line 7
elif city == "Tampa":
^
SyntaxError: invalid syntax

Oops, try again. Did you create a function called plane_ride_cost?


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

The issue you're having is caused by whitespace; the elif statement is being read inside the initial if statement, so your code should look something more like

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

Python relies on whitespace instead of brackets to contain text, but other than that, your code is completely fine!


#3

When writing if/elif/else statments they should have same indentation. Remove space before every elif statment and your code should work.


#4

Thanks so much!!!!!!


#5

Thank you so much bro!


#6

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