Please enable JavaScript to use CodeHS

AP Computer Science Principles in Python

Lesson 4.6 For Loops in Python

Description

In this lesson, students will learn in greater detail about for loops. For loops in Python are written and executed in the same manner as Karel exercises, except now students will explore modifying the initialization statement, test statement, and increment statements of the loops.


Objective

Students will be able to:

  • Create for loops in Python
  • Explain the purpose of for loops
  • Utilize for loops to avoid typing out repeated code
  • Use the loop counter i inside the for loop code to do something different on each iteration