Skip to content
This repository has been archived by the owner on Jan 3, 2024. It is now read-only.

Commit

Permalink
Reto mouredev#43 - Python
Browse files Browse the repository at this point in the history
  • Loading branch information
alberba committed Dec 25, 2023
1 parent 468b893 commit e6b7a97
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions Retos/Reto #43 - SIMULADOR DE CLIMA [Fácil]/python/alberba.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import random


def ficticio(temperatura:int, prob_lluvia:int, dias:int):
dias_lluvia = 0
temperatura_min = temperatura
temperatura_max = temperatura

for dia in range(1, dias + 1):

print(f"Día {dia}: {temperatura} grados y {prob_lluvia}% de probabilidad de lluvia")

if temperatura < temperatura_min:
temperatura_min = temperatura
elif temperatura > temperatura_max:
temperatura_max = temperatura

if prob_lluvia == 100:
dias_lluvia += 1
temperatura -= 1
else:
if random.randint(1, 10) == 1:
temperatura += 2 if random.randint(1, 2) == 1 else -2


if temperatura > 25:

prob_lluvia += 20
if prob_lluvia > 100:
prob_lluvia = 100

elif temperatura < 5:

prob_lluvia -= 20
if prob_lluvia < 0:
prob_lluvia = 0

print(f"Días lluviosos: {dias_lluvia}")
print(f"Temperatura mínima: {temperatura_min}")
print(f"Temperatura máxima: {temperatura_max}")

ficticio(24, 100, 365)

0 comments on commit e6b7a97

Please sign in to comment.