Skip to content

Instantly share code, notes, and snippets.

@raeq
Created July 18, 2020 11:30
Show Gist options
  • Save raeq/485cc18ec205774e8bfa273f46748a40 to your computer and use it in GitHub Desktop.
Save raeq/485cc18ec205774e8bfa273f46748a40 to your computer and use it in GitHub Desktop.
Normal text to leetspeak
def to_leetspeak(normal_speak:str="") -> str:
leet_mapping = str.maketrans("iseoau", "1530^Ü")
return normal_speak.translate(leet_mapping).title().swapcase()
assert to_leetspeak("the quick brown fox jumped over the lazy dogs") == \
"tH3 qÜ1cK bR0wN f0x jÜMP3d 0v3r tH3 l^zY d0g5"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment