ABSTRACT

There are several resources that can be used to modularize source code in a way that we may end up with a small program that calls pre-made code blocks. Python provides several ways to modularize the source code: functions, modules, packages, and classes. Functions are the traditional way to modularize code. Variables declared inside a function are valid only inside the function. To access the contents of a function variable from outside the function, the variable must be returned to the main program by using the return statement. The functions can accept an arbitrary number of arguments with keywords. A module is a file with function definitions, constants, or any type of object that you can use from other modules or from your main program. A package is a group of modules with some characteristics in common. Most packages support pip installation. pip is the native way to install Python packages and is the preferred method.