Python Built-in Functions


Python built-in functions are those functions whose functionality is pre-defined in Python. Python 3 comes with many built-in functions that you can readily use in any Python program.

Python Built-in Functions

In this article, you will be familiar with all the available Python built-in functions. Each of the functions is explained with examples in separate pages.

For example, there is min() function which returns the minimum value of the given iterable. These functions make the life of a programmer easier as many codes and task have already been defined in these functions.

If you want to learn Python, you may also like:

Built-in functions in Python


Python 3, there are 68 built-in functions.

Here is the list of Python built-in functions in alphabetical order.

Python built-in methods with description

__import__( )
This is an advanced function which is invoked when we use the import statement.
abs( )
Returns the absolute value of a number. If the argument is a complex number, its magnitude is returned.
all( )
Returns True if all elements of the iterable are true or if the iterable is empty.
any(iterable)
Returns True if any element of the iterable is true.
ascii( )
It returns printable version of string ‘str’.
bin( )
Converts an integer number to a binary string.
bool( )
Converts a value to a Boolean, using the standard truth testing procedure.
bytearray( )
Returns an array of given byte size. The bytearray type is a mutable sequence of integers in the range 0 <= x < 256.
bytes( )
Return a new bytes object, which is an immutable sequence of integers in the range 0 <= x < 256. It is an immutable version of bytearray.
callable( )
Checks if the object is Callable. Returns True if the object argument appears callable, False if not.
chr(i)
Returns the string of one character whose Unicode codepoint is the integer i. For example, chr(98) returns the string ‘b’.
classmethod( )
Returns a class method for a function. A class method receives the class as implicit first argument, just like an instance method receives the instance.
compile()
Returns a Python code object. Compiles the source into a code or AST (Abstract Syntax Tree) object.
complex()
Creates a complex number.
delattr( )
Deletes attribute from the object. It deletes the named attribute, provided the object allows it.
dict()
Creates a dictionary.
dir( )
It tries to return attributes of the object. Without arguments, returns the list of names in the current local scope. With an argument, attempts to return a list of valid attributes for that object.
divmod(a, b)
Returns a tuple of quotient and remainder.
enumerate( )
Returns an enumerate object for an iterable.
eval()
The eval function lets a python program run python code within itself.
exec()
Executes dynamically created program. It supports dynamic execution of a Python code.
filter( )
It constructs iterator from elements of an iterable for which function returns true.
float( )
It converts a string or a number to floating point.
format( )
Converts a value to a formatted representation i.e. it returns formatted representation of a value.
frozenset( [iterable] ) 
Return a frozenset object, optionally with elements taken from iterable.
getattr( )
It returns the value of the named attribute of an object.
globals( )
It returns a dictionary of the current global symbol table.
hasattr( )
Returns whether the object has named attribute or not.
hash(object)
Returns hash value of the object.
help([object])
It invokes the built-in help system. If no argument is given, the interactive help system starts on the interpreter console else a help page on the object is generated.
hex( )
Converts an integer to the corresponding hexadecimal number.
id(object)
It returns the identity of the object.
input( )
It reads and returns a line of string.
int( )
Converts a number or string to an integer.
isinstance( )
Checks if an object is an instance of the class. Return true if the object is an instance of the class.
issubclass(class, classinfo)
Checks if a class is a subclass of another. Returns true if class is a subclass of the class classinfo.
itr( )
It returns an iterator for an object.
len( )
It returns length of the object.
list( )
Used to create a list in Python.
locals( )
Updates and returns a dictionary representing the current local symbol table.
map( )
Returns an iterator that applies the function to every item of iterable, yielding the results.
max( )
Returns the largest item in the iterable.
memoryview( )
returns memory view of an object supplied as an argument.
min( )
Returns the smallest item in the iterable.
next( )
Retrieves the next item from the iterator by calling its __next__() method.
object( )
Creates a new featureless object.
oct( )
Converts an integer to an octal string.
open( )
Opens a file and return the corresponding stream.
ord( )
Returns an integer representing the Unicode code point of the character.
pow( x, y)
Returns x to the power y.
print( )
Used to print the given object.
property( )
Returns the property attribute.
range( )
Returns a sequence of integers between given range.
repr( )
It returns a string containing a printable representation of an object.
reversed( )
Returns an iterable in reversed order.
round(x[, n])
Returns the floating point value x rounded to n digits after the decimal point.
set( )
Returns a new Python set.
setattr( )
Sets the value of an attribute of the object.
slice( )
Returns a slice object representing the set of indices specified by range(start, stop, step).
sorted( )
Returns sorted list from a given iterable.
staticmethod( )
It creates static method from a function.
str( )
Returns a string version of an object.
sum( )
Adds items of an iterable from left to right and returns the total.
super( )
Returns a proxy object that delegates method calls to a parent or sibling class.
tuple( )
Creates a new tuple.
type( )
Returns the type of an object.
vars( )
Returns __dict__ attribute of a class.
zip( )
Returns an iterator of tuples

Click on the functions to learn in details about them.

You can also check the official documentation of Python built-in functions but if you are beginner then you might find it difficult to get along with official documentation of Python.