-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTemperatureRecordingCalculations.py
More file actions
69 lines (57 loc) · 2.4 KB
/
Copy pathTemperatureRecordingCalculations.py
File metadata and controls
69 lines (57 loc) · 2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#Calculos de temperaturas minimas y maximas segun registros ingresados
#Calculations of minimum and maximum temperatures based on entered records
print("\nBIENVENIDO AL REGISTRO DE DATOS DIARIOS DE TEMPERATURA\n")
print("Ingrese los registros de temperatura (para finalizar ingrese 0): \n")
ambos_error = 0
min_error = 0
max_error = 0
total_min = 0
total_max = 0
promedio_min = 0
promedio_max = 0
dias_error = 0
porcentaje = 0
registro = ()
listado_temperaturas = []
dia=0
while True:
try:
temp_min = float(input("Ingrese temperatura MINIMA para el día " + str(dia+1) + ": "))
temp_max = float(input("Ingrese temperatura MAXIMA para el día " + str(dia+1) + ": "))
registro = (temp_min,temp_max)
print("\n")
while registro != (0,0):
dia+=1
listado_temperaturas.append(registro)
temp_min = float(input("Ingrese temperatura MINIMA para el día " + str(dia+1) + ": "))
temp_max = float(input("Ingrese temperatura MAXIMA para el día " + str(dia+1) + ": "))
registro = (temp_min,temp_max)
print("\n")
for reg in listado_temperaturas:
print(reg)
if reg[0] < 5 and reg[1] > 35:
ambos_error += 1
dias_error += 1
elif reg[0] < 5:
min_error += 1
dias_error += 1
elif reg[1] > 35:
max_error += 1
dias_error += 1
total_min = total_min + reg[0]
total_max = total_max + reg[1]
promedio_min = total_min/dia
promedio_max = total_max/dia
porcentaje = (dias_error/dia)*100
print("\n***************** RESULTADOS *****************")
print("Total dias de salida de campo = " + str(dia))
print("Total días con temperatura minima menor a 5 y maxima mayor a 35 = " + str(ambos_error))
print("Total días con temperatura minima menor a 5 = " + str(min_error))
print("Total días con temperatura maxima mayor a 35 = " + str(max_error))
print("La temperatura media minima es = " + str(format(promedio_min, '.2f')))
print("La temperatura media maxima es = " + str(format(promedio_max, '.2f')))
print("El porcentaje de dias reportados con errores = " + str(format(porcentaje, '.2f')) + "%\n\n")
break
except ValueError:
print("Debe ingresar solo numeros")
continue