In python there are three types one is User-defined functions, then comes the lambda functions in python, and lastly built-in python functions.
In this blog, we will be sharing a list of functions available in python. There are some functions that are predefined by the python interpreter. We don’t have to define these functions to use them, we can directly call them which is why they are called built-in python functions.
A function is a block of code that only runs when it is called. You can pass data, known as parameters, into a function. The most used built-in python function is print()
There is a total of 69 python functions list that are predefined as of now in the latest version of Python 3.8. Let’s have a look at all of them.
Python functions list
abs () | It returns the absolute value of the given number |
all() | It returns true when all elements in an iterable are evaluated to be true or if there are no elements in an iterable. It returns false if any element is evaluated to be false |
any() | Returns True if any elements in an iterable object are true, else it will return false if there are no elements in the iterable to be true i.e false |
asii() | Returns a string containing a printable representation of an object for non-alphabets or invisible characters such as tab, form feed, etc. It returns a readable version of an object. Replaces none-ascii characters with an escape character |
bin() | This function in Python is used for converting an integer to a binary string |
bool() | Converts a value to the bool class object containing either True or False |
bytearray() | This method returns an array of given byte sizes. The bytearray class is a mutable sequence of integers in the range of 0 to 256. |
bytes() | Returns an immutable bytes object |
callable() | This python function is used if the object is callable. It returns True if it is callable or else false |
chr() | Returns a character (string) from an integer of Unicode code |
classmethod() | Converts the method(function) into a class method |
compile() | Returns the specified source as an object, ready to be executed |
complex() | Creates and returns a complex number |
delattr() | Deletes the specified attribute (property or method) from the specified object if the object allows it |
dict() | Creates a python dictionery(array) |
dir() | Returns a list of valid attributes of the specified object |
divmod() | Returns a tuple of two numbers where the first number is the quotient and the second is the remainder |
enumerate() | Takes a collection (e.g. a tuple) and returns it as an enumerate object |
eval() | Evaluates and executes an expression. It runs python code within a program |
exec() | Executes the Python code block passed as a string or a code object. The string is parsed as Python statements and then executed |
filter() | It is used for constructing an iterator from the elements which are true. |
float() | Returns the floating-point number from a number or a string. |
format() | Returns the formatted representation of a value |
frozenset() | Returns an immutable set object with elements from the given iterable. Iterables can be a list, tuple, string, etc |
getattr() | Returns the value of the attribute of an object. If the named attribute does not exist, default is returned if provided otherwise, AttributeError is raised. |
globals() | Returns the current global symbol table as a dictionary |
hasattr() | Checks if the specified object has the specified attribute (property/method) and returns True if so |
hash() | This function of python returns the hash value of the specified object |
help() | It displays the documentation of modules, functions, classes, keywords, etc, basically the built-in help system |
hex() | Converts an integer number to a lowercase hexadecimal value (string) |
id() | Returns identity of an object |
input() | Allows the user to input values |
int() | Returns an integer object constructed from a number or string |
isinstance() | This method returns True if a specified object is an instance of a specified object |
issubclass() | This python functions returns True if a specified class is a subclass of a specified object |
iter() | It returns an iterator object that represents a stream of data for the iterable object |
len() | Returns total length of an object |
list() | This is used to create a python list from an iterable passed as an argument |
locals() | This built-in python function returns an updated dictionary of the current local symbol table |
map() | Returns the specified iterator with the specified function applied to each item |
max() | Returns the largest value from the specified iterable or multiple arguments |
memoryview() | It returns a memory view object of the given object |
min() | Returns the lowest value from the specified iterable or multiple arguments |
next() | It returns the next item from an iterator |
object() | This function returns a new featureless object |
oct() | This function converts an integer into an octal string |
open() | This opens a file and returns a file object |
ord() | It converts an integer representing the Unicode character |
pow() | Returns the specified exponent power of a number ( the value of x to the power of y) |
print() | Prints the given object to the console or to the text stream file. |
property() | This function returns a property attribute |
range() | This method returns the immutable sequence numbers between the specified start and the stop parameter. By default, it starts from 0 and increments by 1. |
repr() | This returns a printable/readable version of an object |
reversed() | Returns the reversed iterator of the given sequence |
round() | returns a floating-point number to n number of the decimal point |
set() | Returns an object of the set class from the specified iterable and its elements |
setattr() | Sets an attribute of an object. It can be a property or a method |
slice() | Returns a slice object specified by the range() function. |
sorted() | Returns a sorted list from the elements in an iterable |
staticmethod() | @staticmethod() Creates a static method from a function |
str() | Returns a string object of the Str class with the specified value |
sum() | Totals the items of the given iterator |
super() | Returns an object that allows us to access methods of the base/parent class |
tuple() | Creates a tuple |
type() | Returns the type of the specified object |
vars() | Returns the __dict__ attribute of the specified object. A __dict__ object used to store an object’s writable attributes |
zip() | Returns an iterator, from two or more iterators and aggregates them in a tuple |
_import_() | An advanced function called by ‘import’ |
Above are the python functions that are built-in and can perform their respective operations when executed.
If you are a beginner the above python functions list may be a lot for you at once. But when used daily you will be used to this. We made this just for a quick reference if you are in need of any function and may not be able to recall it.
Share this blog with your programming buddies and do share in the comments below which python function do you use regularly(except print()).