× Lesson 1 Lesson 2 Lesson 3 Lesson 4 Lesson 5 Lesson 6 Lesson 7 Lesson 8 Lesson 9 Lesson 10 Lesson 11 Lesson 12 Lesson 13 Lesson 14 Lesson 15 Lesson 16 Lesson 17 Lesson 18 Lesson 19 Lesson 20 Lesson 21 Lesson 22 Lesson 23 Lesson 24 Lesson 25 Mini Lesson 1 Mini Lesson 2 Mini Lesson 3 Mini Lesson 4 Mini Lesson 5


Lesson 11 - For Loops

For loops are a very important concept in Python, and will be used throughout your Python programming career. For now, we will keep to the basics of for loops for now.

The basic syntax for a for loop is, for (any letter/word that you want) in (a list): print(the letter/word that you want)

The concept behind a for loop is that it will start at the beginning of a list, interact with that specific index, the index is the position in a list, and starts at 0 rather than 1, such as printing it out, and moving on to the next index in the list until the for loop has gone through every index in the list, it will stop

You can try out the for loop for yourself, such as by looping through [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] and outputting each number when it is being looped through.

I challenge you to find a way to print out your name, using for loops, one letter at a time.