Error - AttributeError: 'float' object has no attribute 'append'
Publicado por Yoleider (1 intervención) el 31/05/2021 20:33:56
Hola a todos, alguno me podria ayudar a responder esta duda, ya que le he dado vueltas y no me funciona :(
al correrlo me genera este error
temp_max.append(temp_max)
AttributeError: 'float' object has no attribute 'append'
se supone que debo poner los siguientes datos y al poner 0 0 debe salir el programa pero siempre se genera error con el ingreso del sexto numero
35
4
36
5
35
5
32
10
34
12
33
8
37
3
0
0
el cod es este
al correrlo me genera este error
temp_max.append(temp_max)
AttributeError: 'float' object has no attribute 'append'
se supone que debo poner los siguientes datos y al poner 0 0 debe salir el programa pero siempre se genera error con el ingreso del sexto numero
35
4
36
5
35
5
32
10
34
12
33
8
37
3
0
0
el cod es este
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
temp_max = []
temp_min = []
cont_dias = 0
error_dias = 0
cont_max = 0
cont_min = 0
conta_all = 0
while True:
temp_max = float(input ('Digita la temperatura Maxima: '))
temp_min = float(input ('Digita la temperatura Minima: '))
if temp_max != 0 and temp_min != 0:
cont_dias = cont_dias + 1
if temp_max > 35 or temp_min < 5:
error_dias = error_dias + 1
if temp_max == 0 and temp_min == 0:
error_dias = error_dias - 1
if temp_max > 35 and temp_min < 5:
conta_all = conta_all + 1
cont_max = cont_max - 1
cont_min = cont_min - 1
if temp_max > 35:
cont_max = cont_max + 1
if temp_min < 5:
if temp_max == 0 and temp_min == 0:
cont_min = cont_min
else:
cont_min = cont_min + 1
if temp_max <= 35 and temp_min >= 5 and temp_max!= 0:
temp_max.append(temp_max)
temp_min.append(temp_min)
if temp_max == 0 and temp_min == 0:
break
suma_temp_max = sum(temp_max)
suma_temp_min = sum(temp_min)
media_max = suma_temp_max/(cont_dias-error_dias)
media_min = suma_temp_min/(cont_dias-error_dias)
porcen_dias_error = (error_dias/cont_dias)*100
print = cont_dias
print = error_dias
print = cont_min
print = cont_max
print = conta_all
print = media_max
print = media_min
print = porcen_dias_error
Valora esta pregunta


0