Python Tuple min() Method


Advertisements

Description

Python tuple method min() returns the elements from the tuple with minimum value.

Syntax

Following is the syntax for min() method −

min(tuple)

Parameters

  • tuple − This is a tuple from which min valued element to be returned.

Return Value

This method returns the elements from the tuple with minimum value.

Example

The following example shows the usage of min() method.

#!/usr/bin/python

tuple1, tuple2 = (123, 'xyz', 'zara', 'abc'), (456, 700, 200)
print "min value element : ", min(tuple1)
print "min value element : ", min(tuple2)

When we run above program, it produces following result −

min value element :  123
min value element :  200
python_tuples.htm
Advertisements