Security scan is checking this page.

Lesson 817 of 1524

Loops

A loop else statement runs after the loop's execution is completed without being interrupted by a break statement

Practice this chapter

A loop else statement runs after the loop's execution is completed without being interrupted by a break statement A break statement is used within a for or a while loop to allow the program execution to exit the loop once a given condition is triggered

A while loop runs a set of statements, known as the loop body, while a given condition, known as the loop expression, is true

break statement — used within a for or a while loop to allow the program execution to exit the loop once a given condition is triggered. loop's execution — completed without being interrupted by a break statement.

Be able to explain the loop construct in Python; use a while loop to implement repeating tasks; explain the for loop construct.

Worked example

What does “break statement” mean in Loops?

  1. 1Use the wording this chapter gives for break statement.
  2. 2The book says: used within a for or a while loop to allow the program execution to exit the loop once a given condition is triggered.
  3. 3Do not use the meaning of loop's execution. That term means completed without being interrupted by a break statement.

Result: used within a for or a while loop to allow the program execution to exit the loop once a given condition is triggered

Why. That is the meaning this chapter gives for break statement.

Do not swap break statement and loop's execution. break statement means used within a for or a while loop to allow the program execution to exit the loop once a given condition is triggered. loop's execution means completed without being interrupted by a break statement.

Practice margin

This chapter

A fresh set from this chapter only. Choose 10 or 20. Multiple choice and fill-in, with no repeat inside the set.