# Index of Maximum Value in a Python List

Finding the index of the maximum value in a list or an array is one of the most common coding interview questions you can get in any coding interview. Here you have to find the index of the maximum value instead of the maximum value itself. So if you want to learn how to find the index of the maximum value in a Python list, then this article is for you. In this article, Iāll walk you through how to find the index of the maximum value in a Python list.

## Index of the Maximum Value in a Python List

Python has a built-in function to find the maximum value in a list. You can also define your Python function for the same task. But the question here is to find the index of the maximum value instead of the value itself. So here is how you can define a Python function to find the index of the maximum value in a Python list:

`Output: 1`

Also, Read ā Index of Minimum Value in a Python List.

The above function implements an algorithm to find the index of the maximum value. It assumes that the list is not empty and that the items in the list are in random order. It starts by treating the first element in the list as the maximum element, then it searches for the largest element on the right, if it finds an element larger than the first, it resets the position of the maximum element. When it reaches the last item in the list by following the same process, it returns the index of the maximum value.

### Summary

So this is how you can find the index of the maximum item in a Python list. It is one of the popular coding interview questions that you may get in any coding interview. I hope you liked this article on how to find the index of the maximum value using the Python programming language. Feel free to ask your valuable questions in the comments section below.

##### Aman Kharwal

I'm a writer and data scientist on a mission to educate others about the incredible power of dataš.

Articles:Ā 1364