Skip to content

Instantly share code, notes, and snippets.

@PyDann
Created March 20, 2014 13:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PyDann/182849dddc763ad46ccc to your computer and use it in GitHub Desktop.
Save PyDann/182849dddc763ad46ccc to your computer and use it in GitHub Desktop.
Compass
if x >= 340 or x <= 20:
return 'N'
elif x > 20 and x < 70:
return 'NE'
elif x >= 70 and x <= 110:
return 'E'
elif x > 110 and x < 160:
return 'SE'
elif x >= 160 and x <= 200:
return 'S'
elif x < 250 and x > 200:
return 'SW'
elif x >= 250 and x <= 290:
return 'W'
else:
return 'NW'
@PyDann
Copy link
Author

PyDann commented Mar 20, 2014

Your second solution should have been more obvious to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment