Python’s List Object type is quite useful for storing data while dealing with Scientific Computations where large amount of data need to be processed. Anyway, in this article => I’ll discuss How to find index of Minimum Element in a Python List?
Now there can be two possible scenarios in which List have just Minimum Number once and other can be situation where list have same minimum numbers twice. [10, 2, 2, 2, 13] this list have Minimum Number = 2 three times, so for this list Python Program should return three index values 1, 2, 3. Similarly [19, 2, 1, 10] list have Minimum Number = 1 just once, so for this list Python Program should return 2. Quite Simple, Just need to write a Python Program which takes care of multiple occurrences of Minimum Number in List. Let’s get into Python Code now for Finding Minimum Number’s Index in a List.
# Python Program to Find smallest number indexes in List a_list = [19, 2, 2, 10, 29, 2, 2, 3] # Define List smallest_number = min(a_list) # Smallest Number in Python List indexes_of_smallest_number =  for i in range(len(a_list)): if a_list[i] == smallest_number: indexes_of_smallest_number.append(i) print("Indexes of Minimum Number in Python List are => ", indexes_of_smallest_number)
Output of Above Code
Indexes of Minimum Number in Python List are => [1, 2, 5, 6]