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 branch 'mouredev:main' into main
- Loading branch information
Showing
17 changed files
with
669 additions
and
9 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")) | ||
|
20 changes: 20 additions & 0 deletions
20
Retos/Reto #10 - LA API [Media]/python/JoseAntonioRuizGarcia.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 @@ | ||
import requests | ||
|
||
def queryPokemon(pokemon: str) -> None: | ||
res = requests.get( | ||
f'https://pokeapi.co/api/v2/pokemon/{pokemon}' | ||
) | ||
if res.ok: | ||
name = res.json()['species']['name'] | ||
type = res.json()['types'][0]['type']['name'] | ||
weight = res.json()['weight'] | ||
|
||
print(f'El Pokemon {name} es de tipo {type} y pesa {weight}') | ||
|
||
else: | ||
print(f'El Pokemon {pokemon} no se encuentra en la API.') | ||
|
||
if __name__ == '__main__': | ||
queryPokemon('ditto') | ||
queryPokemon('pikachu') | ||
queryPokemon('charrizard') |
27 changes: 27 additions & 0 deletions
27
Retos/Reto #11 - URL PARAMS [Fácil]/python/JoseAntonioRuizGarcia.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,27 @@ | ||
URL = 'https://retosdeprogramacion.com?year=2023&challenge=0' | ||
|
||
def extractParams(url: str) -> list: | ||
is_param = False | ||
element = [] | ||
params = [] | ||
|
||
for ch in url: | ||
if ch == '=': | ||
is_param = True | ||
continue | ||
|
||
if ch == '&': | ||
params.append(''.join(element)) | ||
element = [] | ||
is_param = False | ||
|
||
if is_param: | ||
element.append(ch) | ||
|
||
params.append(''.join(element)) | ||
print(params) | ||
|
||
return params | ||
|
||
if __name__ == '__main__': | ||
params = extractParams(url=URL) |
15 changes: 15 additions & 0 deletions
15
Retos/Reto #12 - VIERNES 13 [Fácil]/python/JoseAntonioRuizGarcia.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 @@ | ||
from datetime import datetime | ||
|
||
def isFriday13(date: list [int]) -> bool: | ||
week_day = datetime.weekday(datetime(date[1], date[0], 13)) | ||
if week_day == 4: | ||
is_friday_13 = True | ||
else: | ||
is_friday_13 = False | ||
|
||
return is_friday_13 | ||
|
||
if __name__ == '__main__': | ||
print(isFriday13([11, 2015])) | ||
print(isFriday13([12, 2023])) | ||
|
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
56 changes: 56 additions & 0 deletions
56
Retos/Reto #47 - LA PALABRA DE 100 PUNTOS [Fácil]/c#/IvanHernandezHe.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,56 @@ | ||
/* | ||
* La última semana de 2021 comenzamos la actividad de retos de programación, | ||
* con la intención de resolver un ejercicio cada semana para mejorar | ||
* nuestra lógica... ¡Hemos llegado al EJERCICIO 100! Gracias 🙌 | ||
* | ||
* Crea un programa que calcule los puntos de una palabra. | ||
* - Cada letra tiene un valor asignado. Por ejemplo, en el abecedario | ||
* español de 27 letras, la A vale 1 y la Z 27. | ||
* - El programa muestra el valor de los puntos de cada palabra introducida. | ||
* - El programa finaliza si logras introducir una palabra de 100 puntos. | ||
* - Puedes usar la terminal para interactuar con el usuario y solicitarle | ||
* cada palabra. | ||
*/ | ||
|
||
string alphabet = "abcdefghijklmnñopqrstuvwxyz"; | ||
string word; | ||
int score = 0; | ||
|
||
while(score != 100) | ||
{ | ||
score = 0; | ||
|
||
Console.WriteLine("Ingresa palabra"); | ||
|
||
word = (Console.ReadLine() ?? string.Empty).ToLower(); | ||
|
||
if (word == string.Empty) | ||
{ | ||
Console.WriteLine("No se ingresó ninguna palabra."); | ||
} | ||
else if (word.Any(char.IsNumber) || !word.Any(char.IsLetter)) | ||
{ | ||
Console.WriteLine("Se ingresaron caracteres no válidos."); | ||
} | ||
else | ||
{ | ||
|
||
foreach (char c in word) | ||
{ | ||
|
||
if ( alphabet.Contains(c)) | ||
{ | ||
score = score + alphabet.IndexOf(c)+1; | ||
} | ||
|
||
} | ||
|
||
Console.WriteLine("Tu palabra tiene {0} puntos",score); | ||
|
||
} | ||
|
||
if (score == 100) | ||
{ | ||
Console.WriteLine("¡Acertaste!, has ingresado una palabra de 100 puntos."); | ||
} | ||
} |
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
162 changes: 162 additions & 0 deletions
162
Retos/Reto #47 - LA PALABRA DE 100 PUNTOS [Fácil]/c/Sergio-strazzacappa.c
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,162 @@ | ||
/* | ||
* Crea un programa que calcule los puntos de una palabra. | ||
* - Cada letra tiene un valor asignado. Por ejemplo, en el abecedario | ||
* español de 27 letras, la A vale 1 y la Z 27. | ||
* - El programa muestra el valor de los puntos de cada palabra introducida. | ||
* - El programa finaliza si logras introducir una palabra de 100 puntos. | ||
* - Puedes usar la terminal para interactuar con el usuario y solicitarle | ||
* cada palabra. | ||
*/ | ||
|
||
/* NOTA: | ||
* El compilador de un warning con el uso del carácter especial, ñ pero | ||
* ejecuta sin problemas. Para deshabilitar el warning se puede compilar | ||
* con el flag -w | ||
*/ | ||
|
||
#include <stdio.h> | ||
#include <string.h> | ||
|
||
#define MAX_LONG_WORD (100) | ||
|
||
int word_value(char *word){ | ||
int value = 0; | ||
|
||
for (int i = 0; i < strlen(word); i++) { | ||
switch (word[i]) { | ||
case 'a': | ||
case 'A': | ||
value += 1; | ||
break; | ||
case 'b': | ||
case 'B': | ||
value += 2; | ||
break; | ||
case 'c': | ||
case 'C': | ||
value += 3; | ||
break; | ||
case 'd': | ||
case 'D': | ||
value += 4; | ||
break; | ||
case 'e': | ||
case 'E': | ||
value += 5; | ||
break; | ||
case 'f': | ||
case 'F': | ||
value += 6; | ||
break; | ||
case 'g': | ||
case 'G': | ||
value += 7; | ||
break; | ||
case 'h': | ||
case 'H': | ||
value += 8; | ||
break; | ||
case 'i': | ||
case 'I': | ||
value += 9; | ||
break; | ||
case 'j': | ||
case 'J': | ||
value += 10; | ||
break; | ||
case 'k': | ||
case 'K': | ||
value += 11; | ||
break; | ||
case 'l': | ||
case 'L': | ||
value += 12; | ||
break; | ||
case 'm': | ||
case 'M': | ||
value += 13; | ||
break; | ||
case 'n': | ||
case 'N': | ||
value += 14; | ||
break; | ||
case (char)'ñ': | ||
case (char)'Ñ': | ||
value +=15; | ||
break; | ||
case 'o': | ||
case 'O': | ||
value += 16; | ||
break; | ||
case 'p': | ||
case 'P': | ||
value += 17; | ||
break; | ||
case 'q': | ||
case 'Q': | ||
value += 18; | ||
break; | ||
case 'r': | ||
case 'R': | ||
value += 19; | ||
break; | ||
case 's': | ||
case 'S': | ||
value += 20; | ||
break; | ||
case 't': | ||
case 'T': | ||
value += 21; | ||
break; | ||
case 'u': | ||
case 'U': | ||
value += 22; | ||
break; | ||
case 'v': | ||
case 'V': | ||
value += 23; | ||
break; | ||
case 'w': | ||
case 'W': | ||
value += 24; | ||
break; | ||
case 'x': | ||
case 'X': | ||
value += 25; | ||
break; | ||
case 'y': | ||
case 'Y': | ||
value += 26; | ||
break; | ||
case 'z': | ||
case 'Z': | ||
value += 27; | ||
break; | ||
} | ||
} | ||
return value; | ||
} | ||
|
||
void input(char *word) { | ||
printf("Ingrese una palabra: "); | ||
scanf("%s", word); | ||
} | ||
|
||
int main() { | ||
int value = 0; | ||
|
||
printf("************************\n"); | ||
printf("LA PALABRA DE 100 PUNTOS\n"); | ||
printf("************************\n"); | ||
|
||
do { | ||
char word[MAX_LONG_WORD]; | ||
input(word); | ||
value = word_value(word); | ||
printf("El valor de la palabra %s es: %d\n", word, value); | ||
} while (value != 100); | ||
|
||
printf("Felicidades!!!\n"); | ||
|
||
return 0; | ||
} |
Oops, something went wrong.