...

/

Built-in Functions and Modules

Built-in Functions and Modules

Learn about some basic modules and built-in functions.

We'll cover the following...

Built-in functions

Python has many built-in functions that are always available in any part of the program. The print() function that we use to send output to the screen is a built-in function.

Help for any built-in function is available using help(function).

Built-in functions that are commonly used with numbers are:

abs(x) # returns absolute value of x
pow(x, y) # returns value of x raised to y
min(x1, x2,...)# returns smallest argument
max(x1, x2,...)# returns largest argument
divmod(x, y) # returns a pair(x // y,x % y)
round(x [,n]) # returns x rounded to n digits after .
bin(x) # returns binary equivalent of x
oct(x) # returns octal equivalent of x
hex(x) # returns hexadecimal equivalent of x
Commonly used built-in functions

The following Python program shows how to ...