Answer:
The Benefits of functions in python are:
- Reducing duplication of code
- Decomposing complex problems into simpler pieces
- Improving clarity of the code
- Reuse of code
- Information hiding
Explanation:
Definition:
A function is a block of reusable code that is used to perform a specific action.
There are two basic types of functions: built-in functions and user defined functions. The built-in functions are part of the Python language; for instance dir( ), len( ), or abs( ). The user defined functions are functions created with the def keyword.
Benefits:
Functions in python are among the most important concepts and constructs; here are a few reasons:
- They reduce code duplication in a program. By having a specific task taken care of by a nice block of packaged code that you can import and call whenever you want, you don’t need to duplicate its implementation.
- They help in splitting a complex task or procedure into smaller blocks, each of which becomes a function.
- They improve traceability.
- They improve readability.
- They hide the implementation details from their users.