Index of min element

Python, Math, List · Nov 2, 2020

Returns the index of the element with the minimum value in a list.

  • Use min() and list.index() to obtain the minimum value in the list and then return its index.
def min_element_index(arr):
  return arr.index(min(arr))
min_element_index([3, 5, 2, 6, 10, 7, 9]) # 2

More like this

  • Returns the minimum value of a list, after mapping each element to a value using the provided function.

  • Returns the index of the element with the maximum value in a list.

  • Calculates the average of a list, after mapping each element to a value using the provided function.