I'm trying to get the index of the values higher than 70 from the following list:
temperatures = [33, 66, 65, 62, 59, 60, 62, 64, 70, 76, 80, 69, 80, 83, 68, 79, 61, 53, 50, 49, 53, 48, 45, 39]
But something is going wrong when the loop finds equal values:
hour_ex = []
for i in temperatures:
if i > 70:
hour_ex.append(temperatures.index(i))
print(hour_ex)
The code above is printing:
[9, 10, 10, 13, 15]
When the loop reach the index 12, it prints again the index 10 because it has the same value. I don't know what's going on. How can I fix it?