Taking a vacation: Getting There


#1

Im hoping someone can tell me what Ive done wrong with this code.

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"thats not a vaild entry"


#2

What makes you say you've done something wrong? What are we looking to change about it?
Can you post the intact code? What you posted definitely won't run.


#3

for the lesson 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:
print 'You have entered an invalid city name'

thats all I have to go on based on the current lesson. Im getting this errorOops, try again. It looks like plane_ride_cost does not return 183 when the city is Charlotte.


#4

Then try calling your function with that argument.

print plane_ride_cost('Charlotte')

Code's still unreadable, but the error message says plenty


#5

I appreciate the help but why is the code unreadable?? Im very lost and very new haha


#6

Indentation is part of the code in Python, if you leave it out, then the code is not valid.
Your post should contain exactly the code that you are running


#7

Codecademy can also be pick with spelling and capitals. The places all should start with capitals like you have done for Los Angeles.

Mostly to do with indenting, but I'd recommend doing this also.


#10

This topic is no longer active.