Basics of Python Programming: A Quick Guide for Beginners

Functions

Author(s): Krishna Kumar Mohbey* and Malika Acharya * .

Pp: 61-76 (16)

DOI: 10.2174/9789815179637123010006

* (Excluding Mailing and Handling)

Abstract

Functions are one of the primary concepts in every programming language. They provide an easy way to package the programming logic and use it as and when required as many times at any place. Thus they help to reduce the redundancy in code and increase the reproducibility. With the increase in the length of code, it is often a good idea to divide the code into separate modules by splitting the code into different functions based on its utility. This is a much- sought practice to organise the lengthy code. They also help in unit testing the code as testing small units in isolation is quite an easy task. This deliberate use of functions thus supports language flexibility and a user-friendly interface. In this chapter the pertinent takeaways would be: 1. Understanding functions and function calls. 2. Comprehending the concept of local and global variables. 3. Programming with the recursive functions.

© 2024 Bentham Science Publishers | Privacy Policy