Python Tuple - Min Function

Function Name:

min

Function Signature:

min(tupleObject)

Parameters:

tuple_in: The tuple object in which the smallest of elements to be found.

Return Value:

The smallest of the items present in the tuple object.

Function Overview:

  • The min() function returns the smallest of the elements present in a Python tuple.

Example:

# Example Python program that creates 
# a tuple of numbers and finds the 
# smallest element present

# Create a tuple
quadruple   = [5, 7, 1, 6]

# Find the smallest element present in the tuple
smallest    = min(quadruple)

print("Elements of the tuple:{0}".format(quadruple))
print("The smallest element present in the tuple:{0}".format(smallest))

Output:

Elements of the tuple:[5, 7, 1, 6]

The smallest element present in the tuple:1

 


Copyright 2022 © pythontic.com