forked from mouredev/retos-programacion-2023
-
Notifications
You must be signed in to change notification settings - Fork 0
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 mouredev#6016 from jfdacovich/main
Reto #0 - Python
- Loading branch information
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/python/jfdacovich.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,13 @@ | ||
# Reto 0: El Famoso Fizz Buzz | ||
|
||
for i in range(1,101): | ||
mod3 = i % 3 | ||
mod5 = i % 5 | ||
if mod3 == 0 and mod5 == 0: | ||
print("fizzbuzz") | ||
elif mod3 == 0: | ||
print("fizz") | ||
elif mod5 == 0: | ||
print("buzz") | ||
else: | ||
print(i) |
29 changes: 29 additions & 0 deletions
29
Retos/Reto #1 - EL LENGUAJE HACKER [Fácil]/python/jfdacovich.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,29 @@ | ||
# Reto 1: El Lenguaje del Hacker | ||
|
||
alphabet = { | ||
"a" : "(L", "b" : "!3", "c" : "[", "d" : "|>", "e" : "€", | ||
"f" : "|=", "g" : "(_+", "h" : "#", "i" : "1", "j" : ",_]", | ||
"k" : ">|", "l" : "7", "m" : "nn", "n" : "{\}", "o" : "oh", | ||
"p" : "|7", "q" : "(_,)", "r" : "I2", "s" : "es", "t" : "-|-", | ||
"u" : "|_|", "v" : "\/", "w" : "\/\/", "x" : "ecks", "y" : "j", | ||
"z" : "%", "1" : "L", "2" : "R", "3" : "E", "4" : "A", | ||
"5" : "S", "6" : "b", "7" : "T", "8" : "B", "9" : "g", | ||
"0" : "o" | ||
} | ||
|
||
def translator(texto): | ||
""" | ||
Función que recibe un texto y lo convierte a lenguaje hacker, | ||
Dicho lenguaje se caracteriza por la sustitución de carácteres | ||
alfanuméricos. | ||
""" | ||
converted_text = "" | ||
for letter in texto: | ||
if letter.lower() in alphabet: | ||
converted_text += alphabet[letter.lower()] | ||
else: | ||
converted_text += letter | ||
return(converted_text) | ||
|
||
print(translator("jf_dev_01")) | ||
|