Skip to content

Instantly share code, notes, and snippets.

@jossyboy2580
Created May 27, 2016 10:34
Show Gist options
  • Save jossyboy2580/eb987e0839d894aef2aa802fd55a5a08 to your computer and use it in GitHub Desktop.
Save jossyboy2580/eb987e0839d894aef2aa802fd55a5a08 to your computer and use it in GitHub Desktop.
suffixes = {"1": "st", "2": "nd", "3": "rd"}
def positioner(rang, dog_position):
positions = []
for i in range(1, rang + 1):
if str(i) == str(dog_position):
continue
if str(i) in ["11", "12", "13"]:
positions.append(str(i)+ "th")
else:
positions.append(str(i) + suffixes.get(str(i)[-1], "th"))
return positions
if __name__ == "__main__":
positions = positioner(100, 12)
print positions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment