Types of functions in Python

In Python any task is done through functions. A Python function abstracts or implements the concept of the function in Mathematics. A mathematical function takes one or more parameters and performs 'n' number of constituent steps to produce return value. In the same way a Python function works on a set of parameter values passed to it and exits returning a value.

There are two types of functions in Python. They are built-in functions and user-defined functions. Built-in functions are functions that are incorporated as part of Python Programming Language. To invoke them one does not need to import any modules. Similar to any Python keyword they are readily recognised by Python interpreter. Like using the if statement, the round() function can be readily used without need for importing any module.

Similar to the built-in function round() a developer can create a round() function for a list of numbers. This is an user-defined function. User defined functions are infinite. Given the popularity of the Python Programming Language every second new functions and classes are written. User-defined functions are written by Python Programmers and released as Python modules. In Object Oriented way, functions or methods are bundled as behaviours of classes and released as Python modules.

Copyright 2019 © pythontic.com