Skip to content

Instantly share code, notes, and snippets.

View JadeGrey's full-sized avatar
❄️
Brr...

Sami Syverson JadeGrey

❄️
Brr...
View GitHub Profile
@JadeGrey
JadeGrey / ordinal.py
Created November 23, 2023 22:01
adds an ordinal to a defined number
def ordinal(n):
suffix = ['th', 'st', 'nd', 'rd', 'th'][min(n % 10, 4)]
if 11 <= (n % 100) <= 13:
suffix = 'th'
return str(n) + suffix

394940039810777100