Skip to content

Commit

Permalink
Merge pull request mouredev#4362 from ShinMugenNoKabe/reto1
Browse files Browse the repository at this point in the history
Reto mouredev#1 - Python
  • Loading branch information
Roswell468 authored Jul 30, 2023
2 parents 128f690 + 73b2fe0 commit ea6f236
Showing 1 changed file with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# Escribe un programa que reciba un texto y transforme lenguaje natural a
# "lenguaje hacker" (conocido realmente como "leet" o "1337"). Este lenguaje
# se caracteriza por sustituir caracteres alfanuméricos.
# - Utiliza esta tabla (https://www.gamehouse.com/blog/leet-speak-cheat-sheet/)
# con el alfabeto y los números en "leet".
# (Usa la primera opción de cada transformación. Por ejemplo "4" para la "a")

LEETCODE = {
"a": "4",
"b": "I3",
"c": "[",
"d": ")",
"e": "3",
"f": "|=",
"g": "&",
"h": "#",
"i": "1",
"j": ",_|",
"k": ">|",
"l": "1",
"m": "/\/\\",
"n": "^/",
"o": "0",
"p": "|*",
"q": "(_,)",
"r": "I2",
"s": "5",
"t": "7",
"u": "(_)",
"v": "\\/",
"w": "\/\/",
"x": "><",
"y": "j",
"z": "2"
}


def translate_to_leetcode(text: str) -> str:
return "".join([LEETCODE.get(char.lower(), char) for char in text])


def main():
text = input(translate_to_leetcode("Escribe un texto: "))
print(translate_to_leetcode(text))


if __name__ == "__main__":
main()

0 comments on commit ea6f236

Please sign in to comment.