Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reto #43 - Python #5753

Merged
merged 1 commit into from
Nov 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions Retos/Reto #43 - SIMULADOR DE CLIMA [Fácil]/python/Hugovrc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import random

def simulador_clima(dias: int):
temp_ini = int(input("Digita la temperatura inicial: "))
prob_lluv = int(input("Digita el % de probabilidad de lluvia: "))
dias_luvia = 0
temp_min = 100
temp_max = 0
lluvia = "No"

for dia in range(0, dias):
prob_tem = random.randint(0,10) == 1
aum_o_dis = random.randint(1,2)

if prob_tem:
if aum_o_dis == 1:
temp_ini += 2
else:
temp_ini -= 2
if temp_ini > 25:
if prob_lluv >= 100:
prob_lluv = 100
elif prob_lluv < 100:
restante = 100 - prob_lluv
prob_lluv += restante
else:
prob_lluv += 20
if prob_lluv == 100:
temp_ini -= 1
lluvia = "Si"
if temp_ini < 5:
if prob_lluv <= 0:
prob_lluv = 0
else:
prob_lluv -= 20
if temp_ini > temp_max:
temp_max = temp_ini
if temp_ini < temp_min:
temp_min = temp_ini
if prob_lluv < 100:
lluvia = "No"
if lluvia == "Si":
dias_luvia += 1
print(f"Dia: {dia} , Temperatura: {temp_ini} ,probabilidad de Lluvia: {lluvia, prob_lluv}")
print(f"Temperatura max: {temp_max}")
print(f"Temperatura min: {temp_min}")
print(f"Dias de Luvia: {dias_luvia}")


simulador_clima(10)