Skip to content

Commit

Permalink
Merge pull request mouredev#4479 from SantiALS/Resolución-01
Browse files Browse the repository at this point in the history
Reto #1 - Python
  • Loading branch information
Roswell468 authored Aug 5, 2023
2 parents 1f58b26 + 3235ae6 commit 483208f
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions Retos/Reto #1 - EL LENGUAJE HACKER [Fácil]/python/SantiALS.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@

'''
* 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")
'''

def traductor(texto):

leet = {"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",
"1": "L", "2": "R", "3": "E", "4": "A", "5": "S", "6": "b", "7": "T", "8": "B", "9": "g", "0": "o"}

texto_leet = ''

for clave in texto:

if clave.upper() in leet.keys():
texto_leet += leet[clave.upper()]
else:
texto_leet += clave

return texto_leet

print(traductor("Leet"))
print(traductor("Aquí está un texto de prueba para ver si funciona el reto!"))
print(traductor(input("Texto a traducir: ")))



0 comments on commit 483208f

Please sign in to comment.