Python String Max() Method



The Python string max() method is an inbuilt function of the Python programming language which is known to return the highest or max alphabetical character from a specific string. The return value in this case is a character that is alphabetically the highest character within the string.


Here is the syntax for max() method:



  • str - This is the string from where the highest alphabetical character is to be returned.

Return Value

This method is responsible for returning the max alphabetical character present in the string str.


The example below shows the usage of max() method.


str = "this is really a string example....wow!!!";
print "Max character: " + max(str)

str = "this is a string example....wow!!!";
print "Max character: " + max(str)

When we run the above program, it produces the following result:

Max character: y
Max character: x

Here at Intellinuts, we have created a complete Python tutorial for Beginners to get started in Python.