Stop Repeating Yourself: Mastering Loops in Programming
1 of 4ICT
Stop Repeating Yourself: Mastering Loops in Programming
For grown-ups
Companion summary
Have you ever wondered how a video game keeps running smoothly, even when nothing seems to be happening? Loops power almost everything digital — from streaming music to traffic lights changing on a timer. A single loop in Python can repeat an action a million times in under a second — no copy-pasting needed. When you feel confident, try making a loop that counts down from ten and prints "Blast off" at the end.
How Long Would That Take?
How Long Would That Take?
Imagine you need to print 'Hello!' 1 000 times on screen. Would you really type the same line of code one thousand times? That would take hours — and if you spotted a typo, you'd need to fix every single copy. There has to be a smarter way. Think about everyday life: a washing machine runs its drum round and round until the cycle ends. A traffic light repeats its colour sequence all day. Repetition is everywhere — and programmers have a powerful tool to handle it elegantly: the loop.
💭 Think about this
Without using a computer, how would you tell a robot to clap its hands 10 times using as few words as possible? Write or say your instruction.