Line spacing in between functions?


#1

I was completing taking a vacation and code academy said that my solution ws incorrect, and I believe it was due to line spacing.

my code said this:
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

but the correct answer was the same thing but with a blank line in between the two functions like this:
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

Is this an actual syntax error or is it something with codeacademy’s checking system? Thansk for your help! I want to make sure I learn the proper syntax


#2

If by line spacing you mean blank lines, seems unlikely as that doesn’t do anything in python

You’d need to consider what the difference in behaviour was, or what message you received when it was said to be wrong.

And if anyone else is to look at it you’ll need to ensure it’s an exact copy of what you’re using. What’s in your post isn’t valid syntax.


#3

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