As you learned in Chapter 7, a Python module is any combination of functions, classes, and variables. Python uses modules to group functions and classes in order to make them easier to use. For example, the
turtle module, which we used in previous chapters, groups functions and classes that are used to create a canvas for a turtle to draw on the screen.
When you import a module into a program, you can use all of its contents. For example, when we imported the
turtle module in Chapter 4, we had access to the
Pen class, which we used to create an object representing the turtle’s canvas:
>>>t = turtle.Pen()
Python has a lot of modules for doing all sorts of different tasks. In this chapter, we’ll ...