Page 1 - Lesson Note-Python Modules and Sorting
P. 1
PYTHON MODULES AND SORTING
Modular Programming
Modular programming refers to the process of breaking a large programming task into
separate, smaller, more manageable subtasks or modules. Individual modules can then be
cobbled together like building blocks to create a larger application.
Modules make code simple, easy to maintain and provides reusability.
Functions, modules and packages are all constructs in Python that promote code
modularization.
A module in Python is a simple Python program. It can be built-in (already available in
interpreter) or can be user defined.
Some built in module of Python are: math, statistics, random etc
We can use any Python source file as a module by executing an import statement in some
other Python source file. The import has the following syntax −
import module1[, module2[,... moduleN]
A module is loaded only once, regardless of the number of times it is imported. This
prevents the module execution from happening over and over again if multiple imports
occur.
statistics Module
mean, median, mode – takes one sequence and return one output