image

6GOING LOOPY

Nothing is worse than having to do the same thing over and over again. There’s a reason why some people count sheep when they’re having trouble falling asleep, and it has nothing to do with the amazing sleep-inducing powers of woolly mammals. It’s because endlessly repeating something is boring, and your mind can drop off to sleep more easily if you’re not focusing on something interesting.

Programmers don’t particularly like repeating themselves either, unless they’re also trying to fall asleep. Thankfully, most programming languages have what is called a for loop, which repeats things like other programming statements and blocks ...

Get Python for Kids now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.