Functions and Loops
- 7.9k Downloads
A function is a part of a computer program where a number of programming statements is clubbed as a block. It can be called when desired. This enables a modular approach to programming tasks and has become very popular among programmers nowadays since modules can be edited with ease. Functions receive input parameters and return output parameters. When a function is being used, the function name is called along with values for input parameters. After execution, a set of output parameters is returned. Python functions can be defined at any place in the program, regardless of the place from where they are being called. They can even be defined as a separate file individually or in a combined manner. Also, they can be called any number of times or they may not be called at all, as per the user’s requirements.