fork download
  1. #This script converts to and from l33t speak
  2.  
  3. chars = { "A" : "4",
  4. "B" : "6",
  5. "E" : "3",
  6. "I" : "1",
  7. "L" : "1",
  8. "M" : "(V)",
  9. "N" : "(\)",
  10. "O" : "0",
  11. "S" : "5",
  12. "T" : "7",
  13. "V" : "\/",
  14. "W" : "`//"}
  15.  
  16. def to_l33t(words):
  17. words = words.upper()
  18. if all(x.isalpha() or x.isspace() or x == "." or x == "!" for x in words):
  19. for i in words:
  20. for k , v in chars.items():
  21. words = words.replace(k , v)
  22. else:
  23. for i in words:
  24. for k , v in chars.items():
  25. words = words.replace(v , k)
  26. print(words.lower())
  27.  
  28.  
  29.  
  30. to_l33t("i am the best!")
  31. to_l33t("Da pain!")
  32. to_l33t("Eye need help!")
  33. to_l33t("3Y3 (\)33d j00 t0 g37 d4 d0c70r")
  34. to_l33t("1 n33d m4 p1llz!")
Success #stdin #stdout 0.02s 27712KB
stdin
Standard input is empty
stdout
1 4(\/) 7h3 6357!
d4 p41(\)!
3y3 (\)33d h31p!
eye need joo to get da doctor
l need ma plllz!