For loops explained
Let's say you teach at ABC Elementary School and it's the first day of classes. You've got a small class of 4 students, and you need to call attendance on the first day.
As you look on your attendance sheet, you see the following 4 names:
You read through each name, and gradually you're able to identify each student.
When you read through the list of names on the attendance sheet and called on each student, you were essentially accomplishing the primary purpose of for statements:
For loops are primarily used to loop through a list, or array, of items and enact an action on each item.
Coding an array
Before we learn how to code for loops, we need to learn how to write a list of names in Python.
Make sure to open a Trinket file to follow-along! (How to create a Trinket file?)
We will utilize arrays to accomplish this.
What's an array?
An array is a list of items enclosed in square brackets.
Here's how an array representing the attendance sheet would look: