Class VIII
Chapter – 6, PYTHON FUNCTIONS
1. Answer the following questions:
(a) Python is called a modular programming language because it allows the
use of functions to break a program into smaller, manageable pieces or
modules. This makes the code more organized, reusable, and easier to
maintain as the program grows.
(b) Components of a Python function:
1. def keyword
2. Function name
3. Parameters (arguments)
4. Colon (:) to mark the end of the function header
5. Function body (Python statements)
(c) Steps involved in creating a function:
1. Defining the function – using def, function name, parameters, and
body.
2. Calling the function – by using the function name and passing required
arguments.
(d) We can make a program interactive by using the input() function, which
allows the user to enter data while the program is running.
(e) Types of functions in Python:
1. Built-in functions – Predefined in Python (e.g., print(), input())
2. User-defined functions – Created by the programmer.
2. Fill in the blanks:
(a) User-defined function
(b) built-in
(c) input()
(d) arguments/parameters
(e) (i) Defining a function (ii) Calling a function
(f) user-defined functions
(g) def
(h) unique and easy to correlate with the task
(i) modules
(j) colon (:)
3. Tick the correct option:
(a) (i) modules
(b) (iii) def
(c) (i) :
(d) (i) arguments
(e) (iii) Defining
(f) (iv) All of these
(g) (iii) both print() and input()
(h) (i) input()
(i) (iv) User-defined
(j) (iv) All of these