Page 146 - CodePilot V5.0 C8
P. 146
BRIDGE BACK
1. Name the three jump statements used in Python.
2. How is range(5) different from range(1, 5)?
Python provides many useful features that make programming easier, faster and more powerful.
It gives us various tools to handle numbers, text, groups of data and even advanced tasks.
Among these tools, functions, strings, lists and libraries play a very important role.
FUNCTIONS
It is always advisable to perform a big task by breaking it down into a set of manageable tasks.
This division enables the task to be managed in a more organised manner.
In a programming language, functions are used to divide a bigger program into smaller pieces
or modules. Like other programming languages, Python uses functions too. A function can be
defined as a block of reusable code that performs a specific task.
FEATURES OF FUNCTIONS
Functions are the basis of procedural programming. Some important features of functions are:
Modularity: Functions break a program into smaller, manageable pieces of code.
Reusability: They allow code to be used multiple times without rewriting it.
Abstraction: Functions hide complex details, focusing on what they do rather than how.
Easy debugging: They simplify the process of finding and fixing errors.
Improved readability: Functions make the code clearer and easier to understand.
TYPES OF FUNCTIONS IN PYTHON
One of Python’s strengths is its straightforward approach to functions. They are easy to define
and use. Python functions can be categorised into built-in functions and user-defined functions.
Let’s discuss them in detail.
Built-in Functions
These functions are predefined in
Python and can be used directly
without any further declaration.
Some examples of built-in functions Python has over 70 built-in functions which can be used
are print(), input(), range(), without importing any library.
len(), sum(), min(), max(), etc.
144
CodePilot (V5.0)-VIII

