-
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 #3937 from RonnyG2121/main
reto #0 y #1 Python y C++
- Loading branch information
Showing
3 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/c++/ronnyg2121.cpp
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,26 @@ | ||
#include <iostream> | ||
using namespace std; | ||
|
||
int main(int argc, char const *argv[]) | ||
{ | ||
// Solución al ejercicio #0 | ||
for (int i = 0; i < 101; i++) { | ||
if (i %3 == 0 && i %5 == 0) { | ||
cout << "fizzbuzz\n" << endl; | ||
} | ||
|
||
else if (i %3 == 0) { | ||
cout << "fizz\n" << endl; | ||
} | ||
|
||
else if(i %5 == 0) { | ||
cout << "buzz\n" << endl; | ||
} | ||
|
||
else { | ||
cout << i << endl; | ||
} | ||
} | ||
|
||
return 0; | ||
} |
12 changes: 12 additions & 0 deletions
12
Retos/Reto #0 - EL FAMOSO FIZZ BUZZ [Fácil]/python/ronnyg2121.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,12 @@ | ||
# Mi solución del ejercicio1 | ||
|
||
for i in range(1, 101, 1): | ||
if i %3 == 0 and i %5 == 0: | ||
print("fizzbuzz\n") | ||
|
||
elif i %3 == 0: | ||
print("fizz\n") | ||
elif i %5 == 0: | ||
print("buzz\n") | ||
else: | ||
print(f"{i}\n") |
69 changes: 69 additions & 0 deletions
69
Retos/Reto #1 - EL LENGUAJE HACKER [Fácil]/python/ronnyg2121.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,69 @@ | ||
|
||
|
||
# Método que se usa para convertir el carácter a código leet. Recibirá un parámetro para poder pasarle la información | ||
def converter(text): | ||
|
||
# Diccionario que le asigna el carácter correspondiente ca dada letra | ||
dict_leet = { | ||
"a": "4", | ||
"b": "I3", | ||
"c": "[", | ||
"d": "|)", | ||
"e": "3", | ||
"f": "|=", | ||
"g": "(_+", | ||
"h": ")-(", | ||
"i": "1", | ||
"j": "]", | ||
"k": "|<", | ||
"l": "7", | ||
"m": "|V|", | ||
"n": "|\|", | ||
"o": "()", | ||
"p": "|>", | ||
"q": "0_", | ||
"r": "I2", | ||
"s": "$", | ||
"t": "-|-", | ||
"u": "(_)", | ||
"v": "\/", | ||
"w": "\/\/", | ||
"x": "×", | ||
"y": "¥", | ||
"z": "%", | ||
"1": "L", | ||
"2": "R", | ||
"3": "E", | ||
"4": "A", | ||
"5": "S", | ||
"6": "b", | ||
"7": "T", | ||
"8": "B", | ||
"9": "g", | ||
"0": "o" | ||
} | ||
|
||
# Variable usada para sumarle cada carácter a cada vuelta de bucle | ||
resultado = "" | ||
|
||
# Bucle for que recorre el diccionario y le asigna cada carácter donde corresponda | ||
for i in text: | ||
# Ignorando el carácter en minúscula o mayúscula y convirtiéndolo a string | ||
|
||
i = str(i.lower()) | ||
|
||
# Comprobando si el carácter está en el diccionario | ||
if i in dict_leet: | ||
# Esto es lo que pasa el valor de cada clave en el diccionario | ||
resultado += dict_leet[i] | ||
|
||
# Si no está, se devuelve el carácter original | ||
else: | ||
resultado += i | ||
|
||
# Regresamos la variable resultado | ||
return resultado | ||
|
||
# Probando el programa | ||
entrada = input("Ingrese el texto a convertir y pulse enter") | ||
print(converter(entrada)) |