-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6628 from PatriciaOM/main
Reto01
- Loading branch information
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/python/PatriciaOM.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
28
Retos/Reto #1 - EL LENGUAJE HACKER [Fácil]/python/PatriciaOM.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.") |