CHAPTER 15

image

Libraries and Modules

9781484217894_unFig15-01.jpg

A library is a collection of code for functions and classes. Often, these libraries are written by someone else and brought into the project so that the programmer does not have to reinvent the wheel. In Python the term used to describe a library of code is module.

By using import pygame and import random, the programs created so far have already used modules. A library can be made up of multiple modules that can be imported. Often a library only has one module, so these words can sometimes be used interchangeably. ...

Get Program Arcade Games: With Python and Pygame, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.