Created
May 27, 2016 10:34
-
-
Save jossyboy2580/eb987e0839d894aef2aa802fd55a5a08 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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