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.

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.

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.

Related Articles:

Python all() Method The Python all() method returns True if all the members in the iterable are true. In this article, you will...

Python any() Method The Python any() method returns True if any member in the iterable is true. In this article, you will learn about Python...

Python filter() Function The Python filter() function constructs an iterator from those elements of iterable for which function returns true. In simple words,...

Python hasattr() Function Python hasattr() is a built-in function that returns true if the object has given attribute and false if the object...