Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Python max() method

Python max() method

Python Strings Python Strings


Description

The Python max() method returns the largest letter in a string.

Syntax

max() method syntax:


max(str)

Parameters

Return Value

Returns the largest letter in the string.

Example

The following example shows how to use the max() function:


#!/usr/bin/python

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);

The output of the above example is:


Max character: y
Max character: x

Python Strings Python Strings