Please enable JavaScript to use CodeHS

Utah Introduction to Python 1

Lesson 7.4 While Loops

Description

In this lesson, students will learn that while loops allow code to be executed repeatedly based on a condition. They will also be warned that infinite loops are created if the exit condition of the while loop is never met, causing the code inside the while loop to repeat continuously which causes the program to crash and will learn how the break statement can be used to avoid this.


Objective

Students will be able to:

  • Effectively use while loops in their programs
  • Identify infinite loops
  • Use the break statement inside while loops