simple 1337 translator in python3

I’m playing around with some python3 and my little brother-in-law came up with the idea of a function that takes a string, does a 1337 translation on it, and returns it. I found the replace function that you can do with strings and came up with the following:

def eliteSpeak(word):
  leetWord = word.replace("e","3")
  leetWord = leetWord.replace("E","3")
  leetWord = leetWord.replace("l","1")
  leetWord = leetWord.replace("L","1")
  leetWord = leetWord.replace("o","0")
  leetWord = leetWord.replace("O","0")
  return leetWord

Granted I realized that I don’t know the 1337 speak conventions so I just did some simple replaces. Something like “Oh no, look out for the Listerine spillage.”

eliteSpeak("Oh no, look out for the Listerine spillage.")
'0h n0, 100k 0ut f0r th3 1ist3rin3 spi11ag3.'

If there’s a better way to do it, let me know. Oh btw, I used 2 spaces for formatting instead of tabs.

This entry was posted in software and tagged , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *