String Repetition
The * operator repeats a string a given number of times
What it does: String * int repeats the string that many times. Great for drawing separator lines. Multiplying a string by 0 returns an empty string — perfectly valid. * repeats the string — no spaces are added between repetitions. The string '-' is repeated 3 times with no gaps. String repetition produces no spaces — just the character 10 times. 'Python' repeated twice with no separator. The number can go on either side — 10 * '*' is the same as '*' * 10. String repetition requires an integer multiplier. 2.5 is a float and causes a TypeError.
Common mistakes: Line 2 uses x instead of *. Should be: line = "-" * 10. Line 3 is missing quotes around -. Should be: separator = "-" * 15.
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
"*" * 5?"-" * 3?"Ha" * 3?"=" * 10?"*" * 5 add spaces?Match the Pairs
Key Term
"*" * 10Fill 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 →