Skip to content

Instantly share code, notes, and snippets.

@rjzak
Created October 10, 2018 23:54
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 rjzak/ac0630a32777b212fc67e705751c9eca to your computer and use it in GitHub Desktop.
Save rjzak/ac0630a32777b212fc67e705751c9eca to your computer and use it in GitHub Desktop.
import math
ordinal = lambda n: "%d%s" % (n,"tsnrhtdd"[(math.floor(n/10)%10!=1)*(n%10<4)*n%10::4])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment