It’s rare for someone to write all of a program alone; it’s much more common and productive to make use of the millions of lines of code that other programmers have written before and have packed into modules.
A module is a collection of functions and variables
A module is a collection of variables and functions that are grouped in a single file. The variables and functions in a module are usually related to one another in some way; for example, the math module contains the variable pi and mathematical functions such as cos (cosine) and sqrt (square root). This chapter shows you how to use some of the hundreds of modules that come with Python, as well as how to create your own modules.