-
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 #14 from mouredev/main
Merge
- Loading branch information
Showing
50 changed files
with
1,890 additions
and
2 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/go/ozkar503.go
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 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"strconv" | ||
) | ||
|
||
/* | ||
* 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". | ||
*/ | ||
func main() { | ||
for i := 1; i <= 100; i++ { | ||
if i%3 == 0 && i%5 == 0 { | ||
fmt.Println(strconv.Itoa(i) + " fizzbuzz") | ||
} else if i%3 == 0 { | ||
fmt.Println(strconv.Itoa(i) + " fizz") | ||
} else if i%5 == 0 { | ||
fmt.Println(strconv.Itoa(i) + " buzz") | ||
} else { | ||
fmt.Println(strconv.Itoa(i) + " ---") | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/java/ViankaMB.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,18 @@ | ||
public class ViankaMB { | ||
|
||
public static void main(String[] args) { | ||
for (int x = 1; x <= 100; x++) { | ||
|
||
if (x % 3 == 0 & x % 5 == 0) { | ||
System.out.println("fizzbuzz"); | ||
} else if (x % 3 == 0) { | ||
System.out.println("fizz"); | ||
} else if (x % 5 == 0) { | ||
System.out.println("buzz"); | ||
} else { | ||
System.out.println(x); | ||
} | ||
} | ||
} | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/javascript/DiegoSHS.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,20 @@ | ||
/** | ||
* Imprimer los numeros desde un numero inicial que se le proporcione hasta un numero final, reemplazando los siguientes numeros: | ||
* - 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" | ||
* @param {Number} init Número del que se iniciará | ||
* @param {Number} limit Número en donde se detendrá la iteración | ||
*/ | ||
const fizzbuzz = (init = 0, limit = 100) => { | ||
let text = '' | ||
while (init < limit) { | ||
init++ | ||
text = | ||
(init % 15 === 0) ? `fizzbuzz` : | ||
(init % 3 === 0) ? `fizz` : | ||
(init % 5 === 0) ? `buzz` : init | ||
console.log(text) | ||
} | ||
} | ||
fizzbuzz() |
10 changes: 10 additions & 0 deletions
10
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/javascript/sandybierhoff.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,10 @@ | ||
for(var i = 1; i <= 100; i++) { | ||
if(i % 3 === 0 && i % 5 === 0) | ||
console.log('fizzbuzz'); | ||
else if(i % 3 === 0) | ||
console.log('fizz'); | ||
else if(i % 5 === 0) | ||
console.log('buzz'); | ||
else | ||
console.log(i); | ||
} |
9 changes: 9 additions & 0 deletions
9
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/python/CaesaRR19.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 @@ | ||
''' | ||
* 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". | ||
''' | ||
lista = [print('fizzbuzz') if numero % 15 == 0 else print('fizz') if numero % 3 == 0 else print('buzz') if numero % 5 == 0 else print(numero) for numero in range (1, 101)] |
51 changes: 51 additions & 0 deletions
51
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/python/jlcontini.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,51 @@ | ||
# Reto #0: EL FAMOSO "FIZZ BUZZ" | ||
#### Dificultad: Fácil | Publicación: 26/12/22 | Corrección: 02/01/23 | ||
|
||
## 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". | ||
*/ | ||
``` | ||
#### Tienes toda la información extendida sobre los retos de programación semanales en **[retosdeprogramacion.com/semanales2023] | ||
(https://retosdeprogramacion.com/semanales2023)**. | ||
Sigue las **[instrucciones](../../README.md)**, consulta las correcciones y aporta la tuya propia utilizando el lenguaje de programación que quieras. | ||
> Recuerda que cada semana se publica un nuevo ejercicio y se corrige el de la semana anterior en directo desde **[Twitch](https://twitch.tv/mouredev)**. Tienes el horario en la sección "eventos" del servidor de **[Discord](https://discord.gg/mouredev)**. | ||
""" | ||
|
||
|
||
fizz = "fizz" | ||
buzz = "buzz" | ||
|
||
|
||
def is_multiple(number: int, multiple: int) -> bool: | ||
return number % multiple == 0 | ||
|
||
|
||
def print_numbers_in_range(a, b) -> str: | ||
for i in range(a, b+1): | ||
if is_multiple(i, 3) and is_multiple(i, 5): | ||
print(fizz + buzz + "\n") | ||
elif is_multiple(i, 3): | ||
print(fizz + "\n") | ||
elif is_multiple(i, 5): | ||
print(buzz + "\n") | ||
else: | ||
print(str(i) + "\n") | ||
|
||
|
||
def main(): | ||
print_numbers_in_range(1, 100) | ||
|
||
|
||
|
||
if __name__ == "__main__": | ||
main() |
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
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
45 changes: 45 additions & 0 deletions
45
Retos/Reto #1 - EL LENGUAJE HACKER [Fácil]/java/rearalf.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,45 @@ | ||
import java.io.InputStream; | ||
import java.util.Scanner; | ||
|
||
public class Main { | ||
public static void main(String[] args) { | ||
InputStream steam = System.in; | ||
Scanner scanner = new Scanner(steam); | ||
System.out.print("Enter the text: "); | ||
String input = scanner.next(); | ||
String resultConvert = convertTextToLeet(input.toUpperCase()); | ||
System.out.print(resultConvert); | ||
} | ||
|
||
public static String convertTextToLeet(String text){ | ||
text = text.replaceAll("A" ,"4"); | ||
text = text.replaceAll("B", "|3"); | ||
text = text.replaceAll("C", "["); | ||
text = text.replaceAll("D", "|)"); | ||
text = text.replaceAll("E", "3"); | ||
text = text.replaceAll("F", "ph"); | ||
text = text.replaceAll("G", "6"); | ||
text = text.replaceAll("H", "#"); | ||
text = text.replaceAll("I", "1"); | ||
text = text.replaceAll("J", "]"); | ||
text = text.replaceAll("K", "|<"); | ||
text = text.replaceAll("L", "1"); | ||
text = text.replaceAll("M", "|V|"); | ||
text = text.replaceAll("N", "И"); | ||
text = text.replaceAll("Ñ", "И~"); | ||
text = text.replaceAll("O", "0"); | ||
text = text.replaceAll("P", "|>"); | ||
text = text.replaceAll("Q", "0_"); | ||
text = text.replaceAll("R", "|2"); | ||
text = text.replaceAll("S", "5"); | ||
text = text.replaceAll("T", "7"); | ||
text = text.replaceAll("U", "(_)"); | ||
text = text.replaceAll("V", "|/"); | ||
text = text.replaceAll("W", "uu"); | ||
text = text.replaceAll("X", "><"); | ||
text = text.replaceAll("Y", "j"); | ||
text = text.replaceAll("Z", "2"); | ||
text = text.replaceAll(" ", " "); | ||
return text; | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
Retos/Reto #1 - EL LENGUAJE HACKER [Fácil]/javascript/DiegoSHS.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,59 @@ | ||
const texto = `El fichero de código` | ||
/** | ||
* Transforma un normal a lenguaje hacker | ||
* @param {String} text | ||
*/ | ||
const hackerTranslator = (text) => { | ||
const datamap = { | ||
"a": '4', | ||
"b": 'ß', | ||
"c": '©', | ||
"d": 'cl', | ||
"e": '€', | ||
"f": 'ƒ', | ||
"g": '6', | ||
"h": '#', | ||
"i": '!', | ||
"j": ']', | ||
"k": '|c', | ||
"l": '£', | ||
"m": 'nn', | ||
"n": 'И', | ||
"o": '0', | ||
"p": '|º', | ||
"q": '&', | ||
"r": 'Я', | ||
"s": '$', | ||
"t": '7', | ||
"u": 'บ', | ||
"v": '\/', | ||
"w": 'Ш', | ||
"x": 'Ж', | ||
"y": 'Ч', | ||
"z": '2', | ||
"1": "L", | ||
"2": "R", | ||
"3": "E", | ||
"4": "A", | ||
"5": "S", | ||
"6": "b", | ||
"7": "T", | ||
"8": "B", | ||
"9": "g", | ||
"0": "o", | ||
" ": " " | ||
} | ||
const result = text.toLowerCase().split('').map(e => datamap[e]).join('') | ||
return result | ||
} | ||
/** | ||
* Transforma un normal a lenguaje hacker con expresiones regulares | ||
* @param {String} text | ||
*/ | ||
const Translator = (text) => { | ||
const datamap = [[/0/gi, "o"], [/1/gi, "L"], [/2/gi, "R"], [/3/gi, "E"], [/4/gi, "A"], [/5/gi, "S"], [/6/gi, "b"], [/7/gi, "T"], [/8/gi, "B"], [/9/gi, "g"], [/a/gi, "4"], [/b/gi, "ß"], [/c/gi, "©"], [/d/gi, "cl"], [/e/gi, "€"], [/f/gi, "ƒ"], [/g/gi, "6"], [/h/gi, "#"], [/i/gi, "!"], [/j/gi, "]"], [/k/gi, "|c"], [/l/gi, "£"], [/m/gi, "nn"], [/n/gi, "И"], [/o/gi, "0"], [/p/gi, "|º"], [/q/gi, "&"], [/r/gi, "Я"], [/s/gi, "$"], [/t/gi, "7"], [/u/gi, "บ"], [/v/gi, '\/'], [/w/gi, "Ш"], [/x/gi, "Ж"], [/y/gi, "Ч"], [/z/gi, "2"], [/ /gi, " "]] | ||
datamap.forEach(e => text = text.replace(...e)) | ||
return text | ||
} | ||
|
||
console.log(hackerTranslator(texto)) |
57 changes: 57 additions & 0 deletions
57
Retos/Reto #1 - EL LENGUAJE HACKER [Fácil]/javascript/sandybierhoff.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,57 @@ | ||
|
||
function toHackerLanguage(text) { | ||
|
||
text = text.toLowerCase(); | ||
|
||
let traductionTable = { | ||
a: ['4', '/\\', '@', '/-\\', '^', 'aye', '(L', 'Д]'], | ||
b: ['I3', '8', '13', '|3', 'ß', '!3', '(3', '/3', ')3', '|-]', 'j3', '6'], | ||
c: ['[', '¢', '{', '<', '(', '©'], | ||
d: [')', '|)', '(|', '[)', 'I>', '|>', '?', 'T)', 'I7', 'cl', '|}', '>', '|]'], | ||
e: ['3','&','£','€','ë','[-','|=-'], | ||
f: ['|=', 'ƒ', '|#', 'ph', '/=', 'v'], | ||
g: ['&','6','(_+','9','C-','gee','(?,','[,','{,','<-','(.'], | ||
h: ['#', '/-/', '[-]', ']-[', ')-(', '(-)', ':-:', '|~|', '|-|', ']~[', '}{', '!-!', '1-1', '\-/', 'I+I', '/-\\'], | ||
i: ['1', '[]', '|', '!', 'eye', '3y3', ']['], | ||
j: [',_|', '_|', '._|', '._]', '_]', ',_]', ']', ';', '1'], | ||
k: ['>|', '|<', '/<', '1<', '|c', '|(', '|{'], | ||
l: ['1', '£', '7', '|_', '|'], | ||
m: ['JVI', '[V]', '[]V[]', '|\/|', '^^', '<\/>', '{V}', '(v)', '(V)', '|V|', 'nn', 'IVI', '1^1', 'ITI', 'JTI'], | ||
n: ['^/', '|\|', '/\/', '[\]', '<\>', '{\}', '|V', '/V', 'И', '^', 'ท'], | ||
o: ['0', 'Q', '()', 'oh', '[]', 'p', '<>', 'Ø'], | ||
p: ['|*', '|o', '|º', '?', '|^', '|>', '|"', '9', '[]D', '|°', '|7'], | ||
q: ['(_,)', '9', '()_', '2', '0_', '<|', '&'], | ||
r: ['I2', '|`', '|~', '|?', '/2', '|^', 'lz', '|9', '2', '12', '®', '[z', 'Я', '.-', '|2', '|-'], | ||
s: ['5', '$', 'z', '§', 'ehs', 'es', '2'], | ||
t: ['7', '+', '-|-', '']['', '†', '"|"', '~|~'], | ||
u: ['(_)', '|_|', 'v', 'L|', 'µ', 'บ'], | ||
v: ['|/', '\|'], | ||
w: ['\/\/', 'VV', '\N', '\^/', '(n)', '\V/', '\X/', '\|/', '\_|_/', '\_:_/', 'Ш', 'Щ', 'uu', '2u', '\\//\\//', 'พ', 'v²'], | ||
x: ['><', 'Ж', '}{', 'ecks', '×', '?', ')(', ']['], | ||
y: ['j', '`/', 'Ч', '7'], | ||
z: ['2', '7_', '-/_', '%', '>_', 's', '~/_', '-\_', '-|_'], | ||
0: ['o', '()'], | ||
1: ['L', 'I'], | ||
2: ['R', 'Z'], | ||
3: ['E'], | ||
4: ['A'], | ||
5: ['S'], | ||
6: ['b', 'G'], | ||
7: ['T', 'L'], | ||
8: ['B'], | ||
9: ['g', 'q'] | ||
} | ||
|
||
let traduction = []; | ||
|
||
for(var i=0; i < text.length; i++) { | ||
if(text[i] in traductionTable) { | ||
let position = Math.round(Math.random() * traductionTable[text[i]].length); | ||
traduction.push(traductionTable[text[i]][position]); | ||
} | ||
} | ||
|
||
return traduction.join(''); | ||
} | ||
|
||
console.log( toHackerLanguage('Sandy Averhoff') ); |
51 changes: 51 additions & 0 deletions
51
Retos/Reto #1 - EL LENGUAJE HACKER [Fácil]/python/jlcontini.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,51 @@ | ||
# Reto #1 - Leet translator | ||
|
||
def change_to_leet(original_string: str) -> str: | ||
|
||
leet_dict: dict = {"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"} | ||
|
||
leet_string = "" | ||
upper_case_string = original_string.upper() | ||
|
||
for character in upper_case_string: | ||
if character in leet_dict: | ||
leet_string += leet_dict[character] | ||
else: | ||
leet_string += character | ||
|
||
return leet_string | ||
|
||
|
||
def get_string() -> str: | ||
original_string = str(input("Ingresa el texto que quieras transformar a 'lenguaje hacker': \n")) | ||
return original_string | ||
|
||
|
||
def show_results(original_string, leet_string): | ||
print(f""" | ||
Texto original ingresado: | ||
{original_string} | ||
Texto en formato leet: | ||
{leet_string} | ||
""") | ||
|
||
|
||
def main(): | ||
print("\n\nLEET: esto es una prueba") | ||
print(change_to_leet("LEET: esto es una prueba\n\n")) | ||
|
||
original_string = get_string() | ||
leet_string = change_to_leet(original_string) | ||
show_results(original_string, leet_string) | ||
|
||
print(f'\nResultado de la transformacion: \n{leet_string}\n') | ||
|
||
|
||
|
||
if __name__ == "__main__": | ||
main() |
Oops, something went wrong.