Created
July 18, 2020 11:30
-
-
Save raeq/485cc18ec205774e8bfa273f46748a40 to your computer and use it in GitHub Desktop.
Normal text to leetspeak
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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