🌐
GeeksforGeeks
geeksforgeeks.org › python › python-max-function
Python - max() function - GeeksforGeeks
July 15, 2025 - By default, it will return the string with the maximum lexicographic value. In this example, as max() is used to locate the largest item in Python, we are using max() to find maximum out of 3 string variable.
🌐
Programiz
programiz.com › python-programming › methods › built-in › max
Python max()
# find max among the arguments result = max(4, -5, 23, 5) print("The maximum number is:", result) ... If you need to find the smallest item, you can use the Python min() function.
Discussions

The Python max() function explained - with examples - freeCodeCamp Community - The freeCodeCamp Forum
max() is a built-in function in Python 3. It returns the largest item in an iterable or the largest of two or more arguments. Arguments This function takes two or more numbers or any kind of iterable as an argument. While giving an iterable as an argument, we must make sure that all the elements ... More on forum.freecodecamp.org
🌐 forum.freecodecamp.org
0
June 30, 2026
[request] What is the maximum amount of time interval in seconds possible, if a program checks to update the time every minute, and needs to not have any delay between the actual time and the outputted time?
General Discussion Thread This is a [Request] post. If you would like to submit a comment that does not either attempt to answer the question, ask for clarification, or explain why it would be infeasible to answer, you must post your comment as a reply to this one. Top level (directly replying to the OP) comments that do not do one of those things will be removed. I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns. More on reddit.com
🌐 r/theydidthemath
6
1
March 7, 2025
What is the most pythonic way to limit while loop iterations?
What about just a for range? for _ in range(0, 100): … More on reddit.com
🌐 r/Python
49
41
March 26, 2022
[deleted by user]
Download backtesting locally and modify it to do what you want More on reddit.com
🌐 r/algotrading
16
26
February 19, 2023
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
🌐
W3Schools
w3schools.com › python › ref_func_max.asp
Python max() Function
Python Examples Python Compiler Python Exercises Python Quiz Python Challenges Python Practice Problems Python Server Python Syllabus Python Study Plan Python 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.
🌐
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 - word1 = "apple" word2 = "banana" word3 = "apricot" print(max(word1, word2, word3)) # Output: 'banana' The key parameter changes what Python compares. In this example, max() returns the longest string instead of the string that comes last ...
🌐
Real Python
realpython.com › ref › builtin-functions › max
max() | Python’s Built-in Functions – Real Python
Language: Python · >>> prices = { ... "banana": 1.20, ... "pineapple": 0.89, ... "apple": 1.57, ... "grape": 2.45, ... } >>> max(prices.items(), key=lambda item: item[1]) ('grape', 2.45) This example demonstrates how max() can help you identify the most expensive products by using the dictionary’s values for comparison.
🌐
Hyperskill
hyperskill.org › university › python › max-in-python
Python max() Function — Syntax, key Parameter & Examples
August 10, 2026 - This course is dedicated to core Python skills that will give you a solid base and allow you to pursue any further direction, be it Backend Development or Data Science. ... The max() function in Python is commonly employed to identify the value from a provided collection of elements.
🌐
Learn By Example
learnbyexample.org › python-max-function
Python max() Function - Learn By Example
April 20, 2020 - x = max('red', 'green', 'blue') print(x) # Prints red
Find elsewhere
🌐
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 - When working with strings, the max() function can be used to find the "largest" string based on lexicographical (or alphabetical) order. This means the strings are compared character by character, just like how words are arranged in a dictionary. In this basic Python program example, we have illustrated how to use the max() function to compare strings lexicographically (alphabetical order) and find the maximum string.
🌐
Tutorialspoint
tutorialspoint.com › python › number_max.htm
Python max() Function
# Creating a list List = [74,587,24,92,4,2,7,46] res = max(List) print("The largest number in the list is: ", res) While executing the above code we get the following output − ... In the example below, a list of equal length of strings is created.
🌐
Python Examples
pythonexamples.org › python-max-function
max() Builtin Function
Since the list is empty, if we set default parameter for the max() function, the default value is returned. a = [] largest = max(a, default = 99) print(f'Largest number in the list is : {largest}.') Largest number in the list is : 99. In this tutorial of Python Examples, we learned the syntax ...
🌐
Devcuriosity
devcuriosity.com › manual › details › python-max-function
Python - max() function with examples - DevCuriosity
In this example, with function ord() we can see that letter 'w' has the biggest value - 119. my_list = ["www", "devcuriosity", "com"] my_max = max(my_list, key=len) print(my_max) # devcuriosity
🌐
ThePythonGuru
thepythonguru.com › python-builtin-functions › max › index.html
Python max() function - ThePythonGuru.com
The following is another example where we compare strings based on its length instead of their ASCII values. Try it out: print(max(("python", "lua", "ruby"))) print(max(("python", "lua", "ruby"), key=len)) Output · Input · There also exists a complementary function called min() which finds ...
🌐
Real Python
realpython.com › python-min-and-max
Python's min() and max(): Find Smallest and Largest Values – Real Python
October 22, 2025 - In the second example, the lowercase "w" comes after all the other strings’ initial letters. Note that there are two words that start with "w", "welcome" and "world". So, Python proceeds to look at the second letter of each word. The result is that max() returns "world" because "o" comes after "e".
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-list-max-method
Python List max() Method - GeeksforGeeks
July 23, 2025 - In this example, we will find the maximum value from a list containing integers using Python's max() method.
🌐
Tutorial Gateway
tutorialgateway.org › python-max-function
Python max Function
December 29, 2018 - NOTE: Finding the largest string tuple means it returns the word that starts with the highest Alphabet. # Tuple Example Tp = (12, 22, 32, 42, 52, 62, 72,82) print(max(Tp)) StrTp = ('berry', 'orange', 'banana', 'mango') print(max(StrTp))
🌐
ZetCode
zetcode.com › python › max-builtin
Python max Function - Complete Guide
April 11, 2025 - This example shows max with different numeric inputs. It works with both separate arguments and iterables. Python automatically handles mixed numeric types.
🌐
freeCodeCamp
forum.freecodecamp.org › freecodecamp community
The Python max() function explained - with examples - freeCodeCamp Community - The freeCodeCamp Forum
June 30, 2026 - max() is a built-in function in Python 3. It returns the largest item in an iterable or the largest of two or more arguments. Arguments This function takes two or more numbers or any kind of iterable as an argument. Wh…
🌐
Python Guides
pythonguides.com › maximum-value-in-python-using-the-max-function
How to Find the Maximum Value in Python Using max()
July 27, 2026 - Python can also compare strings alphabetically, based on character codes, walking letter by letter to find the one that comes last. employees = ["Emma", "Liam", "Noah", "Austin"] print(max(employees)) ... I executed the above example code and ...
🌐
Career Karma
careerkarma.com › blog › python › python min and max: the ultimate guide
Python Min and Max: The Ultimate Guide | Career Karma
December 1, 2023 - Our largest character is the lowercase letter z. (To learn more about Python’s ordering system, check out our tutorial on the Python ord() method.) Let’s say that we have a string that contains the grades for every student in a fifth-grade math class. We want to know what the lowest grade was. To calculate the lowest grade, we could use max() function. Here’s an example program that accomplishes this task:
🌐
Python Tutorial
pythontutorial.net › home › python built-in functions › python max() function
Python max(): Return the Maximum Item
September 15, 2022 - result = max('John', 'Alice', 'Jane') print(result) # JohnCopy · The following example shows how to use the max() function with user-defined objects: