More Arithmetic
// performs integer (floor) division, % returns the remainder, and ** raises a number to a power
What it does: After importing math, you access its contents with math.pi or math.sqrt(). random.randint(1, 10) returns a random integer from 1 to 10 inclusive. import gives your program access to extra functions in an external module. Convention is to put all imports at the top so they're easy to find. randint includes both endpoints — could return 1, 2, 3, 4, 5, or 6. sleep() pauses program execution for the given number of seconds. Without 'import random', Python doesn't know what 'random' refers to. The dot . separates the module name from the function name.
Common mistakes: Module name is lowercase: import random, not import Random. Must use dot notation random.randint(), not just randint().
Free printable worksheet with full answer key — or add this module to a journey and assign it to your class.
Take this worksheet further — free with Cloodit
Each concept is reinforced from every angle — learned, then applied, then tested.
Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.
Over 100 of them, across seven natural biomes.
Turns their work into revision material ready for Flash Cards and Exam study.
Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.
Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.
Quick Questions
Match the Pairs
Key Term
importFill in the Blanks
Spot the Error
Create a free class, add this module to a journey, and track who's stuck.
Create a free teacher account →No credit card. No setup fee. Make a class and invite students in under three minutes.
Practice this topic interactively, track progress, and unlock badges.
Start Learning Free →