Skip to content

Summary

Summary

Repetition structures allow the same piece of code to run multiple times.

In this chapter, you learned how to write for loops and while loops in Python. For loops run a block of code a definite number of times. You learned how to use Python's range() function in a for loops and how to use a list or string in a for loop. A while loop runs a block of code as long as a logical condition is true. The keywords break and continue cause for and while loops to exit early.

At the end of the chapter, you learned how to build flowcharts that describe programs with for loops and while loops.

Key Terms and Concpets

repetition structure

loop

while loop

for loop

iterate

break

continue

infinite loop

flowchart