The max documentation states that key is an ordering function, the method gives a new value for each item of the iterable , which will be used for ordering

Without key : natural order

max([4, 3, 5, 6]) 
     4, 3, 5, 6    << values used for finding the max
           ^

With key : order if values given by the key

max([ 4,  3,  5,  6], key=lambda x: -x) 
     -4, -3, -5, -6    << values used for finding the max
          ^

Your case, the list.count, that telles that 2 occurs 2, and that is more than the ones

l =[4, 2, 6, 3, 2]

max([4, 2, 6, 3], key=lambda x: l.count(x))
     1  2  1  1      << values used for max, regarding the
        ^
Answer from azro on Stack Overflow
🌐
W3Schools
w3schools.com › python › ref_func_max.asp
Python max() Function
The max() function returns the item with the highest value, or the item with the highest value in an iterable. If the values are strings, an alphabetically comparison is done. ... The min() function, to return the lowest value.
🌐
Cach3
w3schools.com.cach3.com › python › ref_func_max.asp.html
Python max() Function - W3Schools
Python Overview Python Built-in ... Examples Python Exercises Python Quiz Python Certificate ... The max() function returns the item with the highest value, or the item with the highest value in an iterable....
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-max-function
Python - max() function - GeeksforGeeks
July 15, 2025 - Python max() function returns the largest item in an iterable or the largest of two or more arguments.
🌐
Python Reference
python-reference.readthedocs.io › en › latest › docs › functions › max.html
max — Python Reference (The Right Way) 0.1 documentation
Returns the largest item in an iterable or the largest of two or more arguments · max (collection[, key])
🌐
w3resource
w3resource.com › python › built-in-function › max.php
Python max() function - w3resource
August 19, 2022 - The max() function is used to find the item with the largest value in an iterable.
🌐
Letpy
letpy.io › handbook › builtins › max
Built-in Python Function max: Documentation, Description, and Examples
key (optional): A key function ... and this argument is not specified, a ValueError is raised. max() identifies and returns the element with the highest value in the specified iterable or among the arguments....
Find elsewhere
🌐
ThePythonGuru
thepythonguru.com › python-builtin-functions › max
Python max() function - ThePythonGuru.com
January 7, 2020 - The max() function returns the largest of the input values.Its syntax is as follows:max(iterable[, default=obj, key=func]) -> value PARAMETER …
🌐
Programiz
programiz.com › python-programming › methods › built-in › max
Python max()
key (optional) - key function where the iterables are passed and comparison is performed based on its return value · default (optional) - default value if the given iterable is empty · max() returns the largest element from an iterable. ... If the items in an iterable are strings, the largest ...
🌐
W3Schools
w3schools.com › python › ref_func_min.asp
Python min() Function
The min() function returns the item with the lowest value, or the item with the lowest value in an iterable. If the values are strings, an alphabetically comparison is done. ... The max() function, to return the highest value.
🌐
Hyperskill
hyperskill.org › university › python › max-in-python
Python max() Function — Syntax, key Parameter & Examples
August 10, 2026 - The max() function finds the maximum value among elements of an iterable or a series of arguments. It returns the largest item based on the default ordering or a custom ordering specified by the optional key parameter. When used with iterables like lists or tuples, the function compares the ...
🌐
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 - The same comparison pattern is ... function in Python is a built-in function that returns the largest value from either an iterable (like a list or tuple) or from multiple arguments passed directly....
🌐
YouTube
youtube.com › watch
python max function documentation - YouTube
Instantly Download or Run the code at https://codegive.com the max() function in python is a built-in function that is used to find the maximum value among ...
Published: February 23, 2024
🌐
Jobtensor
jobtensor.com › Tutorial › Python › en › Builtin-Functions-max
Python Built-in max(), Definition, Syntax, Parameters, Examples | jobtensor
The max() function returns the item with the highest value, or the item with the highest value in an iterable. If the values are strings, an alphabetical comparison is done
🌐
AskPython
askpython.com › python › built-in-methods › python-max-method
Python max() Function: Find the Largest Value - AskPython
5 days ago - Python’s built-in max() function returns the greatest item from an iterable or the greatest of two or more separate values.
🌐
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.
🌐
ZetCode
zetcode.com › python › max-builtin
Python max Function - Complete Guide
April 11, 2025 - The Person class implements __gt__ to compare by age. When we call max on a list of Person instances, Python uses this method. This pattern is useful when you want objects to have a natural ordering for comparison operations. The max function raises ValueError when used with empty iterables.
🌐
Python Academy
python-academy.org › functions › max
max — Python Function Reference
A comprehensive guide to Python functions, with examples. Find out how the max function works in Python. Return the largest item in an iterable or the largest of two or more arguments.