I'm trying to delete some of the elements from array this way:
a = [2, 5, 10, 20, 30, 40]
for i in range(len(a)):
print(a[i], i)
if (a[i] > 20):
a = np.delete(a, i)
print(a)
And I am getting an error:
index 5 is out of bounds for axis 0 with the size 5.
I don't really understand what's wrong with my code above.