Advertisement
Guest User

Untitled

a guest
May 27th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. suffixes = {"1": "st", "2": "nd", "3": "rd"}
  2.  
  3. def positioner(rang, dog_position):
  4. positions = []
  5. for i in range(1, rang + 1):
  6. if str(i) == str(dog_position):
  7. continue
  8. if str(i) in ["11", "12", "13"]:
  9. positions.append(str(i)+ "th")
  10. else:
  11. positions.append(str(i) + suffixes.get(str(i)[-1], "th"))
  12.  
  13. return positions
  14.  
  15. if __name__ == "__main__":
  16. positions = positioner(100, 12)
  17. print positions
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement