Python min() function is used to get the min alphabetical character from the string. The Python max() function returns the max alphabetical character from the string. It can also use to find the most considerable item between two or more parameters.
The syntax of the method is: max(iterable, *[, key, default])
The syntax of the method is: min(str)
Below is the python program to demonstrate the max() function:
str = "The Best Learning Resource for Online Education"; print (max(str)) str = "Technology Motivator"; print (max(str))
When we run above the program, the outcome is as follows:
u
y
Below is the python program to demonstrate the min() function:
str = "The Best Learning Resource for Online Education"; print (min(str)) str = "Technology Motivator"; print (min(str))
Python Min and Max with Strings
We used the min() and max() methods for finding the smallest and largest values in the list in the above cases.
You will also locate the smallest and most extensive character in a string using min() and max(). The smallest and most significant in this situation apply to the character’s position in the alphabet.
The smallest character, like all significant letters, come first in Python, is the capital letter A. The uppercase letter z is our most prominent character.
Below are several other functions that we can use to work with string in Python 3