mikecharles
2/8/2016 - 9:33 PM

Ordinal of a number in Python

Ordinal of a number in Python

ordinal = lambda n: "%d%s" % (n,"tsnrhtdd"[(n/10%10!=1)*(n%10<4)*n%10::4])