Chapter 6
A Modular Approach to Program Organization

Mathematicians don’t prove every theorem from scratch. Instead, they build their proofs on the truths their predecessors have already established. In the same way, 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.

A module is a collection of variables and functions that are grouped together in a single file. The variables and functions in a module are usually related to one another in some way; for example, module math 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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.187.113