String Repetition
The * operator repeats a string a given number of times
Understanding String Repetition in Python
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 class and your students practise it interactively.
This module's key terms are also in a printable crossword (Modules 1–10) and word search (Modules 1–20).
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
Student with a class code? Join your class →