Python Tuple max() Method

Python 元组Python Tuple


Description

The Python tuple max() function returns the maximum value of elements in the tuple.

Syntax

Syntax of the max() method:

max(tuple)

Parameters

  • tuple -- The specified tuple.

Return Value

Returns the maximum value of elements in the tuple.

Examples

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

#!/usr/bin/python

tuple1, tuple2 = (123, 'xyz', 'zara', 'abc'), (456, 700, 200)

print "Max value element : ", max(tuple1);
print "Max value element : ", max(tuple2);

The output of the above example is:

Max value element :  zara
Max value element :  700

Python 元组Python Tuple

Other Extensions