0
Good afternoon guys, I’m having problems with python lists...
lateral = []
for i in range(3):
lateral = float(input("Por favor, informe o valor de cada lado,
seguidamente:" ))
if(lateral[0] == lateral[1]) and (lateral[1] == lateral[2]) and
(lateral[0] == lateral[2]):
print('Seu triangulo é equilatero')
elif(lateral[0] == lateral[1]) or (lateral[1] == lateral[2]) and
(lateral[0] == lateral[2]):
print('Seu triangulo é isoceles')
else:
print("Se triangulo é escaleno")
But every time I try, he reports this mistake:
Traceback (most recent call last):
File "/home/...../...../MODULO II/E2Q1.py", line 4, in <module>
if(lateral[0] == lateral[1]) and (lateral[1] == lateral[2]) and
(lateral[0] == lateral[2]):
TypeError: 'float' object is not subscriptable
But the comparison becomes normal when executed directly... Could help me understand my mistake and how to fix it?
I did an edit to try to understand where the
for
and theifs
– FBidu