Please enable JavaScript to use CodeHS

Utah Computer Programming 1 and 2

Lesson 1.9 For Loops

Description

In this lesson, students learn how to use for loops in their programs. The for loop allows you to repeat a specific part of code a fixed number of times.

A for loops is written as follows:

for i in range(4):
    # Code to be repeated 4 times


Objective

Students will be able to:

  • Create for loops to repeat code a fixed number of times
  • Explain when a for loop would be a useful tool
  • Utilize for loops to write programs that would be difficult/impossible without loops