C
Building Your own
Modules
Throughout this book, you’ve imported modules like
turtle, random, and pygame into your programs to add
functions for drawing, generating a random number,
and animating graphics without having to code them
from scratch. But did you know that you can also
write your own modules and import them into your
programs? Python makes it easy to build modules so
you can save useful code and use it in many programs.