Please enable JavaScript to use CodeHS

Hawaii EXS0100 Intro to Computer Science A

Lesson 1.4 For Loops

Description

In this lesson, students are introduced to for loops. They learn how for loops simplify the process of making small changes to a program and help avoid repeating code. For loops are written like this:

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