Python Tuple - max function

To find the element with maximum value in a Python tuple object, use the max function provided

Tuple Updated 19 Sep 2016 1 min read

Function Name

max

Function Signature

max(tupleObject)

Parameters

tupleObject - The tuple on which the maximum element to be found.

Return value

The largest element present in a tuple.

Function Overview

  • The max() function returns the largest element present in a Python tuple.

Example

python
# Example Python program that finds the

            # largest of the elements present in a tuple

            nums = (1, 15, 7, 25, 17, 35, 30)

            max(nums)

            print("Tuple of numbers:{0}".format(nums))

            largest = max(nums)

            print("The largest number in the tuple is {0}".format(largest))

Output

Output
Tuple of numbers:(1, 15, 7, 25, 17, 35, 30)

The largest number in the tuple is 35