Repeating What You’ve Learned

In this chapter, you learned the following:

  • Repeating a block is a fundamental way to control a program’s behavior. A for loop can be used to iterate over the items of a list, over the characters of a string, and over a sequence of integers generated by built-in function range.

  • The most general kind of repetition is the while loop, which continues executing as long as some specified Boolean condition is true. However, the condition is tested only at the beginning of each iteration. If that condition is never false, the loop will be executed forever.

  • The break and continue statements can be used to change the way loops execute.

  • Control structures like loops and conditionals can be nested inside one another to any desired depth.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.225.254.192