What am i doing wrong


#1

Taking a Vacation
Getting There

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
    else:
        return 'none'

#2

Charlotte is a city, because it is a city, it should be a string. Not a variable


#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
else:
return 'None'

it gives this error now-
Oops, try again. It looks like plane_ride_cost does not return 475 when the city is Los Angeles.


#4

since when is Los Angeles written with underscore in the name? I always just use a space


#5

Question:

Originally I filled out the return number as:

return "183"
instead of:
return 183

Is it the case that numbers never should be in between comma’s (or what do you call “” ?)

Thank you


#6

Why did you revive a 10 month old topic for this?

Because using quotation marks, its a string. lets say we go to Charlotte for 3 days, using strings results in:

print "420" +  "183" # 420183
print 420 + 183 # 603

that is why we don’t use quotation marks.


#7

Mea culpa, I don’t have a lot of experience using fora. Should I have started a new topic for my question?

Thanks for your reply, this is clear now.


#8

yes, the guidelines say:

Don’t divert a topic by changing it midstream.

which is what you do when you ask your own question in an existing topic


#9