What are “modules” and why should you care?
Step 1 – What are “modules” and why should you care?
You are not here to reinvent the wheel—you’re here to build games. Python agrees. That’s why it comes with modules: ready-made code you can plug into your game.
- Module = a Python file that contains useful code (functions, variables, classes).
- Think of it as a toolbox you can borrow instead of building every tool yourself.
You “borrow” a toolbox with the import keyword.
Your first import: the math toolbox
Engine loading… please wait.
What’s going on here?
import mathYou’re telling Python: “Load the math toolbox so I can use its stuff.”
math.sqrt(25)Uses the square root function from the math module.
Result: 5.0
math.piGives you the value of π (pi).
Result:3.141592653589793 (aka “the circle guy”)
⚡ Quick challenge
Change the code below so it prints the square root of 64 instead of 25.
- Change the number inside sqrt(…) to 64.
- Update the text to “Square root of 64:”.
Practice editor ready. Modify the code and click Run.


