Simplest approach:

in [24]: a = [4, 34, 0, 0, 6, 34, 1]

In [25]: j=0

In [26]: M=[]

In [27]: m = max(a)

In [28]: for i in a:
    if i==m:
        M.append(j)
    j+=1
   ....:     

In [29]: M
Out[29]: [1, 5]

Using list-comprehension and enumerate, the above can be shortened to:

In [30]: [i for i, x in enumerate(a) if x == max(a)]
Out[30]: [1, 5]
Answer from Fredrik Pihl on Stack Overflow
🌐
Programiz
programiz.com › python-programming › methods › built-in › max
Python max()
key (optional) - key function where each argument is passed, and comparison is performed based on its return value · Basically, the max() function finds the largest item between two or more objects. max() returns the largest argument among the multiple arguments passed to it.
Discussions

dictionary - Using Python's max to return two equally large values - Stack Overflow
I'm using Python's max function to find the largest integer in a dictionary called count, and the corresponding key (not quite sure if I'm saying it properly; my code probably explains itself bette... More on stackoverflow.com
🌐 stackoverflow.com
max - Which maximum does Python pick in the case of a tie? - Stack Overflow
When using the max() function in Python to find the maximum value in a list (or tuple, dict etc.) and there is a tie for maximum value, which one does Python pick? Is it random? This is relevant i... More on stackoverflow.com
🌐 stackoverflow.com
multiple maximums in a list python - Stack Overflow
Hey so being the NEWBY I am I was wondering how I could find multiple maximums (i.e. there is more than one maximum or item of the same length) and minimums(same situ as maximums) from a list. I've... More on stackoverflow.com
🌐 stackoverflow.com
How do I find the relative maximum in a function?
Take the derivative and find where it equals zero. Also, do your calculus homework using calculus! But seriously - give us more context. You really can use numpy/scipy to get a derivative, or you can scan the function with some arbitrary input, or you can ask questions we can't answer without proper setup. WHY are you trying to find a local maxima? What inputs do you have? What context is this in? More on reddit.com
🌐 r/Python
7
1
January 23, 2014
People also ask

What is the use of the max() and min() functions in Python?
We use Python's max() and min() functions to get the maximum or minimum object out of a set of objects or max/min object out of objects in a given iterable.
🌐
interviewkickstart.com
interviewkickstart.com › home › blogs › learn › max() function in python: syntax, parameters, and examples
max() Function in Python: Syntax, Parameters & Examples
What is the difference between the Python max() and min() functions?
Both compare items or items within an iterable on some basis and return a value. But the max() function in Python returns the max value after those comparisons, and the min() function returns the minimum value.
🌐
interviewkickstart.com
interviewkickstart.com › home › blogs › learn › max() function in python: syntax, parameters, and examples
max() Function in Python: Syntax, Parameters & Examples
🌐
Interview Kickstart
interviewkickstart.com › home › blogs › learn › max() function in python: syntax, parameters, and examples
max() Function in Python: Syntax, Parameters & Examples
April 1, 2026 - It determines the result by comparing ... one it encounters. The Python max function is used in two common ways: you can pass multiple values directly, or you can pass a single iterable such as a list, tuple, or strin...
🌐
W3Schools
w3schools.com › python › ref_func_max.asp
Python max() Function
Python Examples Python Compiler ... Interview Q&A Python Training ... The max() function returns the item with the highest value, or the item with the highest value in an iterable....
🌐
Hyperskill
hyperskill.org › university › python › max-in-python
Python max() Function — Syntax, key Parameter & Examples
August 10, 2026 - It efficiently determines and returns the highest value within that sequence, which is valuable for data analysis or identifying the largest element in a dataset. The function can compare multiple values without needing complex if-else statements or loops, enhancing code readability and simplicity.
🌐
AskPython
askpython.com › python › built-in-methods › python-max-method
Python max() Function: Find the Largest Value - AskPython
5 days ago - Follow max()’s result for a record ranked by key= to see whether it returns the selected item or a comparison value. Python’s built-in max() function returns the greatest item from an iterable or the greatest of two or more separate values.
Find elsewhere
🌐
ThePythonGuru
thepythonguru.com › python-builtin-functions › max
Python max() function - ThePythonGuru.com
January 7, 2020 - ... The max() function returns ... then the default value is returned, otherwise, a ValueError exception is raised. If max() is called with multiple arguments, it returns the largest one....
🌐
Learn By Example
learnbyexample.org › python-max-function
Python max() Function - Learn By Example
April 20, 2020 - The max() function can find the largest of two or more values (such as numbers, strings etc.) or the largest item in an iterable (such as list, tuple etc.)
🌐
GeeksforGeeks
geeksforgeeks.org › python › maximum-of-two-numbers-in-python
Find the Maximum of two numbers in Python - GeeksforGeeks
For example: Input: a = 10, b = 8 Output: 10 · Let's explore different ways to find the larger of two numbers. max() function compares two or more values and returns the largest one.
Published: May 18, 2026
🌐
Unstop
unstop.com › home › blog › python max() function | all use cases with code examples
Python max() Function | All Use Cases With Code Examples
February 12, 2025 - The Python max() function helps find the largest or maximum value from between multiple objects or in iterables.
🌐
Pierian Training
pieriantraining.com › home › using the max function in python
Using the Max Function in Python - Pierian Training
April 28, 2023 - In summary, when using the max() function with numeric values in Python: – It returns the largest value among its arguments. – It can be used with multiple numeric values separated by commas or with a list of numeric values.
🌐
LabEx
labex.io › tutorials › python-how-to-handle-multiple-max-values-in-dict-438210
How to handle multiple max values in dict | LabEx
At LabEx, we understand that mastering dictionary operations is crucial for efficient Python programming. The techniques demonstrated here form the foundation of advanced data manipulation skills. ## Dictionary with potential multiple max values performance = { 'Project A': 95, 'Project B': 95, 'Project C': 88 } ## Finding all keys with maximum value max_value = max(performance.values()) max_projects = [key for key, value in performance.items() if value == max_value] print(f"Projects with max performance: {max_projects}")
🌐
Real Python
realpython.com › ref › builtin-functions › max
max() | Python’s Built-in Functions – Real Python
The built-in max() function allows you to find the largest values in an iterable or among multiple arguments.
🌐
GeeksforGeeks
geeksforgeeks.org › maximum-of-two-numbers-in-python
Find Maximum of two numbers in Python - GeeksforGeeks
For example, given two numbers ... explore different ways to do this efficiently. max() function is the most optimized solution for finding the maximum among two or more values....
Published: May 9, 2025
🌐
Tutorialspoint
tutorialspoint.com › python › number_max.htm
Python max() Function
The Python max() function is used to retrieve the largest element from the specified iterable. Finding the maximum of two given numbers is one of the usual calculations we perform.
🌐
Devcuriosity
devcuriosity.com › manual › details › python-max-function
Python - max() function with examples - DevCuriosity
max(iterable_1, ..., key=func, default=obj) returns the largest item from a single iterable or the largest of two or more arguments. Accepts optional key-word key argument that needs to be a function that will be used to evaluate each item's number/value.