Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

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
            

 
 
  Published under the terms of the Open Publication License Design by Interspire