# Python | Find Index of Maximum Number in List

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 Maximum Element in a Python List?

Now there can be two possible scenarios in which List have just Maximum Number once and other can be a situation where list have same maximum numbers twice. [16, 82, 9, 17, 72, 72, 60, 72] this list have Maximum Number = 72 three times, so for this list Python Program should return three index values 4, 5, 7. Similarly [7, 8, 19, 6, 1] list have Maximum Number = 19 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 Maximum Number in List. Let’s get into Python Code now for Finding Maximum Number’s Index in a List.

``````# Python Program to Find Largest number indexes in List

a_list = [8, 91, 28, 91, 2, 6]     # Define List

largest_number = max(a_list)	   # Largest Number in Python List

indexes_of_largest_number = []

for i in range(len(a_list)):
if a_list[i] == largest_number:
indexes_of_largest_number.append(i)

print("Indexes of Minimum Number in Python List are => ", indexes_of_largest_number)``````

Output of Above Code

``Indexes of Minimum Number in Python List are =>  [1, 3]``

Gagan

Hi, there I'm founder of ComputerScienceHub(Started this to bring useful Computer Science information just at one place). Personally I've been doing JavaScript, Python development since 2015(Been long) - Worked upon couple of Web Development Projects, Did some Data Science stuff using Python. Nowadays primarily I work as Freelance JavaScript Developer(Web Developer) and on side-by-side managing team of Computer Science specialists at ComputerScienceHub.io