Tuple Built-in Functions

A number of built-in functions create or process tuples.

len( object ) → integer

Return the number of items of a sequence or mapping.

max( tuple ) → value

Return its largest item in the sequence.

min( tuple ) → value

Return its smallest item in the sequence.

any( tuple ) → boolean

Return True if there exists an item in the sequence which is True.

all( tuple ) → boolean

Return True if all items in the sequence are True.

divmod( x , y ) → ( div , mod )

Return the tuple ((x-x%y)/y, x%y). Invariant: div*y + mod == x. This is the quotient and the remainder in division.

The divmod functions is often combined with multiple assignment. For example:

>>> 
q,r= divmod(355,113)

>>> 
print q,"*113+",r,"=355"

3 *113+ 16 =22