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 remote-tracking branch 'origin/main' into main
- Loading branch information
Showing
87 changed files
with
2,918 additions
and
15 deletions.
There are no files selected for viewing
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
30 changes: 30 additions & 0 deletions
30
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/c#/mchocho99.cs
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,30 @@ | ||
public static void reto0() | ||
{ | ||
/* | ||
* 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". | ||
*/ | ||
for (int i = 0; i <= 100; i++) | ||
{ | ||
string result = ""; | ||
if (i % 3 == 0) | ||
{ | ||
result += "fizz"; | ||
} | ||
if (i % 5 == 0) | ||
{ | ||
result += "buzz"; | ||
} | ||
if (result.Equals("")) | ||
{ | ||
Console.WriteLine(i); | ||
} else | ||
{ | ||
Console.WriteLine(result); | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/javascript/aaizaguirre.js
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,14 @@ | ||
for (let i = 1; i <= 100; i++){ | ||
if (i % 15 === 0){ | ||
console.log("fizzbuzz"); | ||
continue; | ||
} if (i % 3 === 0){ | ||
console.log("fizz"); | ||
continue; | ||
} if (i % 5 === 0){ | ||
console.log("buzz"); | ||
continue; | ||
} else{ | ||
console.log(i) | ||
}; | ||
}; |
13 changes: 13 additions & 0 deletions
13
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/javascript/guido2288.js
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 @@ | ||
for (let i = 1; i <= 100; i++) { | ||
|
||
if (i % 3 === 0 && i % 5 === 0) { | ||
console.log('fizzbuzz' + '\n') | ||
} else if (i % 3 === 0 && i % 5 != 0) { | ||
console.log('fizz' + '\n') | ||
} else if (i % 3 != 0 && i % 5 === 0) { | ||
console.log('buzz' + '\n') | ||
} else { | ||
console.log(i + '\n') | ||
} | ||
|
||
} |
24 changes: 24 additions & 0 deletions
24
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/javascript/mchocho99.js
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,24 @@ | ||
export const reto0 = () => { | ||
/* | ||
* 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". | ||
*/ | ||
for (let i = 1; i <= 100; i++) { | ||
let result = ""; | ||
if (i % 3 === 0) { | ||
result += "fizz"; | ||
} | ||
if (i % 5 === 0) { | ||
result += "buzz"; | ||
} | ||
if (result) { | ||
console.log(result) | ||
} else { | ||
console.log(i); | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/php/josea2r.php
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,23 @@ | ||
/* | ||
* 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". | ||
*/ | ||
|
||
<?php | ||
|
||
for ($i = 1; $i <= 100; $i++) { | ||
|
||
if ($i % 3 == 0 && $i % 5 == 0) { | ||
echo $i . " fizzbuzz\n"; | ||
} elseif ($i % 3 == 0) { | ||
echo $i . " fizz\n"; | ||
} elseif ($i % 5 == 0) { | ||
echo $i . " buzz\n"; | ||
} else { | ||
echo $i . "\n"; | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/php/mchocho99.php
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 @@ | ||
<?php | ||
function reto0() { | ||
/* | ||
* 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". | ||
*/ | ||
for ($i = 1; $i <= 100; $i++ ) { | ||
$return = ""; | ||
if ($i % 3 === 0) { | ||
$return .= "fizz"; | ||
} | ||
if ($i % 5 === 0) { | ||
$return .= "buzz"; | ||
} | ||
if ($return === "") { | ||
echo $i; | ||
echo "<br>"; | ||
} else { | ||
echo $return; | ||
echo "<br>"; | ||
} | ||
} | ||
} | ||
|
||
reto0(); |
15 changes: 15 additions & 0 deletions
15
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/python/Air94.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,15 @@ | ||
|
||
def analyze(n): | ||
if i%5 == 0 and i%3==0: | ||
print("\nfizzbuzz") | ||
elif i%5 == 0: | ||
print("\nbuzz") | ||
elif i%3==0: | ||
print("\nfizz") | ||
else: | ||
print("\n", i) | ||
|
||
|
||
for i in range(1, 101): | ||
analyze(i) | ||
|
9 changes: 9 additions & 0 deletions
9
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/python/aaizaguirre.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,9 @@ | ||
for i in range(1,101): | ||
if i % 15 == 0: | ||
print("fizzbuzz") | ||
elif i % 3 == 0: | ||
print("fizz") | ||
elif i % 5 == 0: | ||
print("buzz") | ||
else: | ||
print(i) |
24 changes: 24 additions & 0 deletions
24
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/python/akaidmaru.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,24 @@ | ||
''' | ||
* 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 fizzbuzz(): | ||
for num in range(1, 101): | ||
if num % 3 == 0 and num % 5 == 0: | ||
print('FizzBuzz\n') | ||
elif num % 3 == 0: | ||
print('Fizz\n') | ||
elif num % 5 == 0: | ||
print('Buzz\n') | ||
else: | ||
print(f'{num}\n') | ||
|
||
|
||
if __name__ == "__main__": | ||
fizzbuzz() |
20 changes: 20 additions & 0 deletions
20
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/python/ignafuentes.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 @@ | ||
## Enunciado | ||
|
||
# /* | ||
# * 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". | ||
# */ | ||
|
||
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) |
11 changes: 11 additions & 0 deletions
11
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/python/martin-aq.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,11 @@ | ||
def fizzbuzz(): | ||
for num in range(1,101): | ||
if num % 3 == 0 and num % 5 == 0: | ||
print("fizzbuzz") | ||
elif num % 3 == 0: | ||
print("fizz") | ||
elif num % 5 == 0: | ||
print("buzz") | ||
else: | ||
print(num) | ||
fizzbuzz() |
23 changes: 23 additions & 0 deletions
23
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/python/saurivane.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,23 @@ | ||
""""" | ||
/* | ||
* 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 fizzbuzz(num): | ||
if num%3 == 0 and num%5 == 0: | ||
return "fizzbuzz" | ||
elif num%3 == 0: | ||
return "fizz" | ||
elif num%5 == 0: | ||
return "buzz" | ||
else: | ||
return num | ||
|
||
for i in range(1,101): | ||
print(fizzbuzz(i)) |
25 changes: 25 additions & 0 deletions
25
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/typescript/zerchito.ts
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,25 @@ | ||
/* | ||
* 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". | ||
*/ | ||
|
||
const MAX = 100; | ||
const MIN = 1; | ||
function fizzbuzz(): void { | ||
for(let num = MIN; num<=MAX; num++){ | ||
let response = ''; | ||
if ( num%3 ===0 ) { | ||
response = 'fizz'; | ||
} | ||
if ( num%5 === 0 ) { | ||
response = response + 'buzz'; | ||
} | ||
console.log(response || num); | ||
} | ||
} | ||
|
||
fizzbuzz(); |
54 changes: 54 additions & 0 deletions
54
Retos/Reto #1 - EL LENGUAJE HACKER [Fácil]/java/mchocho99.java
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,54 @@ | ||
private static final Map<Character,String> DICTIONARY = new HashMap<>() {{ | ||
put('A', "4"); | ||
put('B', "I3"); | ||
put('C', "["); | ||
put('D', ")"); | ||
put('E', "3"); | ||
put('F', "|="); | ||
put('G', "&"); | ||
put('H', "#"); | ||
put('I', "1"); | ||
put('J', ",_|"); | ||
put('K', ">|"); | ||
put('L', "£"); | ||
put('M', "/\\/\\"); | ||
put('N', "^/"); | ||
put('O', "0"); | ||
put('P', "|*"); | ||
put('Q', "(_,)"); | ||
put('R', "I2"); | ||
put('S', "5"); | ||
put('T', "7"); | ||
put('U', "(_)"); | ||
put('V', "\\/"); | ||
put('W', "\\/\\/"); | ||
put('X', "><"); | ||
put('Y', " j"); | ||
put('Z', "2"); | ||
put('0', "o"); | ||
put('1', "L"); | ||
put('2', "R"); | ||
put('3', "E"); | ||
put('4', "A"); | ||
put('5', "S"); | ||
put('6', "b"); | ||
put('7', "T"); | ||
put('8', "B"); | ||
put('9', "g"); | ||
put(' ', " "); | ||
}}; | ||
|
||
public static void reto1 (String text) { | ||
/* | ||
* 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") | ||
*/ | ||
String upperText = text.toUpperCase(); | ||
for (int i = 0; i < upperText.length(); i++) { | ||
System.out.print(DICTIONARY.get(upperText.charAt(i))); | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
Retos/Reto #1 - EL LENGUAJE HACKER [Fácil]/javascript/guido2288.js
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,45 @@ | ||
function leetLenguaje(word) { | ||
|
||
const leetWord = word.toLowerCase() | ||
.replaceAll('1', 'L') | ||
.replaceAll('2', 'R') | ||
.replaceAll('3', 'E') | ||
.replaceAll('4', 'A') | ||
.replaceAll('5', 'S') | ||
.replaceAll('6', 'b') | ||
.replaceAll('7', 'T') | ||
.replaceAll('8', 'B') | ||
.replaceAll('9', 'g') | ||
.replaceAll('0', 'o') | ||
.replaceAll('a', '4') | ||
.replaceAll('b', 'I3') | ||
.replaceAll('c', '[') | ||
.replaceAll('d', ')') | ||
.replaceAll('e', '3') | ||
.replaceAll('f', '|=') | ||
.replaceAll('g', '&') | ||
.replaceAll('h', '#') | ||
.replaceAll('i', '1') | ||
.replaceAll('j', ',_|') | ||
.replaceAll('k', '>|') | ||
.replaceAll('l', '1') | ||
.replaceAll('m', '/\\/\\') | ||
.replaceAll('n', '^/') | ||
.replaceAll('o', '0') | ||
.replaceAll('p', '|*') | ||
.replaceAll('q', '(_,)') | ||
.replaceAll('r', 'I2') | ||
.replaceAll('s', '5') | ||
.replaceAll('t', '7') | ||
.replaceAll('u', '(_)') | ||
.replaceAll('v', '\/') | ||
.replaceAll('w', '\/\/') | ||
.replaceAll('x', '><') | ||
.replaceAll('y', 'j') | ||
.replaceAll('z', '2') | ||
|
||
return leetWord; | ||
}; | ||
|
||
console.log(leetLenguaje('Hello word!')) | ||
|
Oops, something went wrong.