4.12. 👩‍💻 Keeping Track of Your Iterator Variable and Your Iterable

When students first begin using for loops, they sometimes have difficulty understanding the difference between the iterator variable (the loop variable) and the iterable.

The iterable is the object that you will parsing through in a for loop, typically a String or list, or other type of sequence. Generally, this object does not change while the for loop is being executed.

The iterator (loop) variable is the variable which stores an element of the iterable (such as an item in the list or a single character from a String) when the for loop is being executed. Each time the loop iterates, the value of the iterator variable will change to a different element of the iterable.

As you go through the codelens window, you will be asked a set of questions.

Activity: CodeLens 4.12.10 (clensQuestions4_12_1)

Activity: CodeLens 4.12.11 (clensQuestion4_12_2)

You have attempted of activities on this page