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.
- Loading branch information
Showing
3 changed files
with
76 additions
and
2 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
45 changes: 45 additions & 0 deletions
45
Retos/Reto #43 - SIMULADOR DE CLIMA [Fácil]/python/mouredev.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,45 @@ | ||
import random | ||
|
||
|
||
def weather_simulator(temperature: int, rain: int, days: int): | ||
|
||
rainy_days = 0 | ||
min_temperature = temperature | ||
max_temperature = temperature | ||
|
||
for day in range(1, days + 1): | ||
|
||
print( | ||
f"Día {day}: {temperature} grados y {rain}% de probabilidad de lluvia") | ||
|
||
if rain == 100: | ||
rainy_days += 1 | ||
|
||
if temperature < min_temperature: | ||
min_temperature = temperature | ||
|
||
if temperature > max_temperature: | ||
max_temperature = temperature | ||
|
||
if random.randint(1, 10) == 1: | ||
temperature += 2 if random.randint(1, 2) == 1 else -2 | ||
|
||
if temperature > 25: | ||
rain += 20 | ||
if rain > 100: | ||
rain = 100 | ||
|
||
elif temperature < 5: | ||
rain -= 20 | ||
if rain < 0: | ||
rain = 0 | ||
|
||
if rain == 100: | ||
temperature -= 1 | ||
|
||
print(f"Días lluviosos: {rainy_days}") | ||
print(f"Temperatura mínima: {min_temperature}") | ||
print(f"Temperatura máxima: {max_temperature}") | ||
|
||
|
||
weather_simulator(24, 100, 365) |
28 changes: 28 additions & 0 deletions
28
Retos/Reto #44 - ADIVINANZAS MATEMÁTICAS [Media]/ejercicio.md
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 @@ | ||
# Reto #44: Adivinanzas matemáticas | ||
#### Dificultad: Media | Publicación: 13/11/23 | Corrección: 20/11/23 | ||
|
||
## Enunciado | ||
|
||
``` | ||
/* | ||
* Crea un juego interactivo por terminal en el que tendrás que adivinar | ||
* el resultado de diferentes | ||
* operaciones matemáticas aleatorias (suma, resta, multiplicación | ||
* o división de dos números enteros). | ||
* - Tendrás 3 segundos para responder correctamente. | ||
* - El juego finaliza si no se logra responder en ese tiempo. | ||
* - Al finalizar el juego debes mostrar cuántos cálculos has acertado. | ||
* - Cada 5 aciertos debes aumentar en uno el posible número de cifras | ||
* de la operación (cada vez en un operando): | ||
* - Preguntas 1 a 5: X (entre 0 y 9) operación Y (entre 0 y 9) | ||
* - Preguntas 6 a 10: XX (entre 0 y 99) operación Y (entre 0 y 9) | ||
* - Preguntas 11 a 15: XX operación YY | ||
* - Preguntas 16 a 20: XXX (entre 0 y 999) operación YY | ||
* ... | ||
*/ | ||
``` | ||
#### 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)**. |