Friday, March 9, 2018

String max() Method


String max() Method in Python 3


The max() method returns the max alphabetical character from the string str.
Syntax
max(str)

Parameters
str - This is the string from which max alphabetical character needs to be returned.
Return Value
This method returns the max alphabetical character from the string str.
Example
#!/usr/bin/python3
str = "this is a string example....really!!!"
print ("Max character: " + max(str))
str = "this is a string example....wow!!!"
print ("Max character: " + max(str))

Result
Max character: y
Max character: x