Good afternoon guys, I'm having trouble with lists in python ...
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, it reports this error:
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
However, the comparison happens normal when executed directly ... Could you help me understand this error and how do I fix it?