I have a list of values with elements zero and elements different from zero and wanted to return the lowest value of the list and its index, but ignoring the zeros, that is, the fact that there are zeros does not mean that it is the smallest value simply that it is not to be read.
So in a list of this sort: B=[6, 9, 4, 0, 7, 10, 2, 5, 0, 0, 0, 4, 11]
I wanted it to return the value 2 and in this case the index 6.
I tried to do it:
for a in range(0,len(B)):
if (B[a]!=0 and B[a]<B[a+1]):
b_min=B[a]
indice=a
But it does not give what I want.
Can someone help me?