© James R. Payne 2019
James R. PaynePython for Teenagershttps://doi.org/10.1007/978-1-4842-4550-7_5

5. Loops and Logic

James R. Payne1 
(1)
Deerfield Beach, FL, USA
 

Sometimes fighting crime can make you feel like you are running around in circles. Day in and day out you seem to have to tackle the same struggles: a bank robber here, a cat stuck in a tree over there, an evil genius trying to take over the universe. It is almost as if you are stuck in some sort of…loop.

While being stuck in a proverbial Groundhog Day – a day that repeats itself over and over and an excellent flick starring Bill Murray (ask your parents) – is a bad thing, using loops in your computer programs can be a great thing. One of the prime purposes of computer programs is to repeat ...

Get Python for Teenagers: Learn to Program like a Superhero! 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.