← VCE Software Development U4O1

The math module

Loads Python's math module, giving you extras like math.sqrt(), math.pi, math.ceil() and math.floor() that basic operators don't have. Call them with the math. prefix.

Understanding The math module in VCE Software Development U4O1

What it does: The import line loads the module. Without it, using the math. prefix causes a NameError. math.pi holds the value of pi (3.14159...), so you do not need to type it out yourself. Python uses the import keyword to load a module. 'include' is used in other languages like C, not Python. math.sqrt() gives the square root of a number. The square root of 49 is 7, returned as the float 7.0. 24.5 would be 49 divided by 2. math.pi is a constant value, not a function. Calling math.pi() causes a TypeError because a float cannot be called. math.ceil() always rounds UP to the next whole number, so 4.2 becomes 5. Rounding down is the job of math.floor().

Common mistakes: After import math, sqrt() must be called with the math. prefix. It should be math.sqrt(49). Python is case-sensitive. The variable is called area, not Area, so this would cause a NameError. It should be print(area).

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 115–124) and word search (Modules 115–171).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
Which line loads Python's math module so you can use math.sqrt()?
import mathinclude math
Matches
sqrt(25)
↓
The math. prefix is missing. After import math, the function must be called as math.sqrt(25).
Applying
Meanings
Term
import math
Meaning
Loads Python's math module, giving you extras like math.sqrt(), math.pi, math.ceil() and math.floor() that basic operators don't have. Call them with the math. prefix.
Practice
import math
Testing
Gaps
math
Check Answer
Spots
1import math
2root = sqrt(49)

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Bear' badge — Forest Guardian, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. Which line loads Python's math module so you can use math.sqrt()?
A. import math ✓
B. include math
Python uses the import keyword to load a module. 'include' is used in other languages like C, not Python.
2. What does math.sqrt(49) return?
A. 24.5
B. 7.0 ✓
math.sqrt() gives the square root of a number. The square root of 49 is 7, returned as the float 7.0. 24.5 would be 49 divided by 2.
3. After import math, which is the correct way to call the square root function?
A. math.sqrt(25) ✓
B. sqrt(25)
Functions from the module need the math. prefix when you use import math. Writing sqrt(25) alone causes a NameError.
4. What is math.pi?
A. A function you call as math.pi()
B. A constant, about 3.14159, written without brackets ✓
math.pi is a constant value, not a function. Calling math.pi() causes a TypeError because a float cannot be called.
5. What does math.ceil(4.2) return?
A. 5 ✓
B. 4
math.ceil() always rounds UP to the next whole number, so 4.2 becomes 5. Rounding down is the job of math.floor().

Match the Pairs

math.sqrt(49) → Returns the square root of 49, which is 7.0
math.ceil(4.2) → Rounds 4.2 up to the next whole number, 5
Import the math module first so its functions and constants can be used → import math
Use the math module's built-in constant for pi to find the area of a circle → area = math.pi * r ** 2
sqrt(25) → The math. prefix is missing. After import math, the function must be called as math.sqrt(25).
print(math.floor(7.9)) # expects 8 → math.floor() rounds down, so it gives 7, not 8. Use math.ceil() to round up to 8.

Key Term

import math
Loads Python's math module, giving you extras like math.sqrt(), math.pi, math.ceil() and math.floor() that basic operators don't have. Call them with the math. prefix.

Fill in the Blanks

1. import math print(math.sqrt(49))
Hint: Type the keyword that loads a module into your program.
2. import math root = math.sqrt(64) print(root)
Hint: Type the math function that finds a square root.
3. import math area = math.pi * 5 ** 2 print(area)
Hint: Type the math module's constant for the ratio of a circle's circumference to its diameter, with the module prefix.
4. import math pages = math.ceil(23 / 10) print(pages)
Hint: Type the math function that always rounds a number up to the next whole number.
5. import math whole = math.floor(7.9) print(whole)
Hint: Type the math function that always rounds a number down to the nearest whole number.

Spot the Error

Question 1
A import math
B root = sqrt(49)
C print(root)
Line B — After import math, sqrt() must be called with the math. prefix. It should be math.sqrt(49).
Question 2
A import math
B r = 5
C area = math.pi * r ** 2
D print(Area)
Line D — Python is case-sensitive. The variable is called area, not Area, so this would cause a NameError. It should be print(area).
Question 3
A import math
B n = math.cieling(4.2)
C print(n)
Line B — The function name is misspelt. The math module's round-up function is math.ceil(), so it should be n = math.ceil(4.2).
Question 4
A import maths
B x = math.floor(7.8)
C print(x)
Line A — The module is called math, not maths. Importing maths causes a ModuleNotFoundError. It should be import math.
Question 5
A import math
B side = 16
C root = math.sqrt[side]
D print(root)
Line C — Functions are called with round brackets, not square brackets. It should be math.sqrt(side).

Student with a class code? Join your class →