Skip to content

Commit

Permalink
Merge pull request #6628 from PatriciaOM/main
Browse files Browse the repository at this point in the history
Reto01
  • Loading branch information
Roswell468 authored Jul 26, 2024
2 parents 3b1e9eb + ed864bf commit 460006b
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/python/PatriciaOM.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"""
Escribe un programa que muestre por consola (con un print) los
números de 1 a 100 (ambos incluidos y con un salto de línea entre
cada impresión), sustituyendo los siguientes:
Múltiplos de 3 por la palabra "fizz".
Múltiplos de 5 por la palabra "buzz".
Múltiplos de 3 y de 5 a la vez por la palabra "fizzbuzz".
"""
def reto_1():
for number in range (1, 101):
if number%3 == 0 and number%5 == 0:
print("fizzbuzz")
elif number%3 == 0:
print("fizz")
elif number%5 == 0:
print("buzz")
else:
print(number)

reto_1()
28 changes: 28 additions & 0 deletions Retos/Reto #1 - EL LENGUAJE HACKER [Fácil]/python/PatriciaOM.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""
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 lenguaje_hacker(text):
new_text = ""
list_indexes = []
alphabet_numbers = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m"
,"n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"
,"1", "2", "3", "4", "5", "6", "7", "8", "9", "0", " ", ".", ","]
leet_alphabet_numbers = ["4", "I3", "[", ")", "3", "|=", "&", "#", "1", ",_|", ">|", "1",
"/\/\\", "^/", "0", "|*", "(_,)", "I2", "5", "7", "(_)", "\/",
"\/\/", "><", "j", "2", "L", "R", "E", "A", "S", "b", "T", "B",
"g", "o", " ",".", ","]
for letter in text:
for character in alphabet_numbers:
if letter.lower() == character:
list_indexes.append(alphabet_numbers.index(character))
for index in list_indexes:
new_text = new_text + leet_alphabet_numbers[index]
print(new_text)

lenguaje_hacker("Hola, me llamo Patricia.")

0 comments on commit 460006b

Please sign in to comment.