4
I have a list of values with zero elements and elements other than zero and I wanted to return the lowest value of the list and its Index, but ignoring the zeroes, that is, the fact that there are zeros does not mean that it is the lowest value but simply that it is not to be read.
So on a list like this: B=[6, 9, 4, 0, 7, 10, 2, 5, 0, 0, 0, 4, 11]
i wanted to return the value 2 and in this case the index 6.
I tried to make:
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 doesn’t give what I want.
Can someone help me?
Both work, thank you very much!!!
– Sofia Raimundo