Python Tuple - max function

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:

# 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:

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

The largest number in the tuple is 35


Copyright 2024 © pythontic.com