Introduction
Imagine needing to print the numbers 1 to 100. You could write 100 print() statements—or you could use a loop. Loops let you repeat a block of code automatically, making your programs shorter, smarter, and easier to maintain.
In this module, you learn about Python's two loop types: the for loop, which repeats a set number of times, and the while loop, which repeats as long as a condition is true. You also learn how to control loop behavior with break and continue. You'll apply these skills to build a Guess the Number game.