Skip to content

Instantly share code, notes, and snippets.

@bmispelon
Created May 18, 2022 11:05
Show Gist options
  • Save bmispelon/76f951a16f566d94636361af4f14943e to your computer and use it in GitHub Desktop.
Save bmispelon/76f951a16f566d94636361af4f14943e to your computer and use it in GitHub Desktop.
Convert an integer into english
import sys, unicodedata
def int_to_english(n: int) -> str:
"""
Convert the given integer into english (only works reliably for numbers between 1 and 31).
"""
return unicodedata.name(chr(13279 + n)).split()[-1]
if __name__ == '__main__':
print(int_to_english(int(sys.argv[1])))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment