Example 2: Using tuple max() Method for string elements

Here we are finding the maximum element out of the tuple that constitutes string elements based on length.

Python3




# Creating tuples
Tuple = ( "Geeks", "For", "Geeks", "w3wiki")
  
res = max(Tuple)
print('Maximum of Tuple is', res)


Output:

Maximum of Tuple is w3wiki

Python Tuple – max() Method

While working with tuples many times we need to find the maximum element in the tuple, and for this, we can also use max(). In this article, we will learn about the max() method used for tuples in Python.

Example

Tuple =( 4, 2, 5, 6, 7, 5)

Input:

max(Tuple)

Output: 7

Explanation: The max() method returns the largest element of the given tuple.

Similar Reads

Python tuple max() Method

Syntax: max(object) Parameters: object: Any iterable like Tuple, List, etc. Return type: maximum element from the tuple....

Example 1: Using tuple max() Method

Here we are finding the max of a particular tuple....

Example 2: Using tuple max() Method for string elements

...

Example 3: Using max for equal-length elements

Here we are finding the maximum element out of the tuple that constitutes string elements based on length....