Nov-10-2020, 10:44 AM
Hi,
I have the below list, and I want to get the index of minimum element which is >3 & <=8.
I have the below list, and I want to get the index of minimum element which is >3 & <=8.
my_list = [-1,4,-5,0,2,11,9,8,6] #below only grep minimum whose value >0 m = min(i for i in my_list if i > 0) but I want a minimum element between 3 & 8 I use the below code, but it does not work. It still gives me an answer is 2. m2 = min(i for i in my_list if i > 0 & i<=8)Someone help, how to achieve this.