If you need to find the index of the minimum element in a list, you can do one of the following:

Option 1 – Using min() and index()

1
2
3
lst = [8,6,9,-1,2,0]
m = min(lst)
print(lst.index(m))

Output: 3

Option 2 – Using min() and for

1
2
3
4
5
6
lst = [8,6,9,-1,2,0]
m = min(lst)
for i in range(len(lst)):
    if(lst[i]==m):
        print(i)
        break

Output: 3

Option 3 – Using min() and enumerate()

1
2
3
lst = [8,6,9,-1,2,0]
a,i = min((a,i) for (i,a) in enumerate(lst))
print(i)

Output: 3

Option 4 – Using min() and operator.itemgetter()

1
2
3
4
from operator import itemgetter
lst = [8,6,9,-1,2,0]
i = min(enumerate(lst), key=itemgetter(1))[0]
print(i)

Output: 3

Option 5 – Using numpy.argmin()

1
2
3
4
import numpy as np
lst = [8,6,9,-1,2,0]
i = np.argmin(lst)
print(i)

Output: 3