![]() | ![]() |
Modules consist of definitions as well as program statements.
An illustration is a file name config.py which is considered as a module. The module name would be config. Modules are sued to help break large programs into smaller manageable and organized files as well as promoting reusability of code.
Example
Creating the First module
Start IDLE.
Navigate to the File menu and click New Window.
Type the following:
Def add(x, y):
“””This is a program to add two
numbers and return the outcome"""
outcome=x+y
return outcome