3. Getting There


#1

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 was trying to figure out what is wrong with this code but I was not very successful. The error message displayed is:

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

Ugh, I did. On line 4. :frowning:

Any help would be appreciated.

Cheers,
Andreia


#2

You forgot a colon on this line, :slight_smile:


#3

I have put the colon and it dowsn't work as well :confused:
The same error is displayed.


#4

Is the code above all of your code? If not please post all of it. :slight_smile:


#5

If your code above is indented like this it should work,

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

#6

I copy and pasted my first code, now from a different computer and it worked now. It must have been cache or some hidden bug, dunno. Thanks anyway bandit :wink:


#7

You're welcome. :slight_smile: It could also be the browser you are using sometimes the console cannot evaluate your code correctly because of the current browser settings.


#8

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