30 seconds of python

  Back to Home

max_element_index

listbeginner

Returns the pindex of the element with the maximum value in a list.

Use max() and list.index() to get the maximum value in the list and return its index.

def max_element_index(arr):
  return arr.index(max(arr))