How Can We Help?
Introduction:
In this tutorial, we are going to explain how to use Python tuple max function with basic syntax and many examples for better understanding.
Python tuple max is used to get a maximum value of a tuple.
Syntax:
max(tuple_variable_name)
Input Parameters:
- tuple_variable_name : where tuple is tuple variable whose minimum value needs to be found.
Example
number=(1,2,3) alphanumeric=('x','A','a') # maximum value of tuple print('max of number:', max(number)) print('max of alphanumeric:', max(alphanumeric))
Output
max of number: 3
max of alphanumeric: x
In the above Example, If comparing values of tuple variable ‘number’ ,value ‘3’ is larger than value ‘1’ and ‘2’ so output of max(number) is ‘3’ and for tuple variable ‘alphanumeric’, let’s take ASCII code of tuple values(x,A,a) is (120, 65,97) respectively. If comparing ASCII values, 120 is larger than 65 and 97 so output of max(alphanumeric) is 120 which is indicated by ‘x’.
Note: Python v2 supports different data type of value like (‘abc’,1),(12,’xya’) etc in tuple for min() & max() function and Python v3 supports only same data type of value like (1,2),(‘abc’,’dfe’) etc for min() & max() function.
In this tutorial, you have learned how to use python tuple max() function.
If you have an inquiry or doubt don’t hesitate to leave them in comment. we are waiting your feedback.But remember to understand the concept very well, you need to practice more.
Hopefully, it was clear and concise.
Similar Python tuple max Functions:
- Tuples : is a form of data collection where different type of data can be stored and separated by commas(,).
- min(tuple) : It returns a minimum value of tuple.
- type(tuple) : It returns a maximum value of tuple.
- len(tuple) : It returns type of tuple , if passed variable is tuple.
- tuple(seq) : It converts a sequence/string into tuple.
- del(tuple) : It deletes whole tuple or individual tuple element or all elements of tuple.
Python tutorials list:
- Python tutorials list : access all python tutorials.