
C H A P T E R 3
Modules and Functions
3.1 INTRODUCTION
A program is usually par titio ne d into modular units, a nd in Py thon, these are
modules, classes, and functions. A function is the most fundamental module
or decomposition unit in Pytho n programs. When called (invoked), a function
carries out a specific task in a program and can receive input data from another
function; these input data are known as arguments. T he function can also
return output data when it completes execution.
This chapter provides details on function definitions, invocation, and de-
composition. It also discusses the basic mechanisms for data transfer between
two functions;