Python-Programming-Lesson-Notes

5.2 Understanding the loops

Given the following loop:

word = 'oxygen'
for char in word:
  print(char)

How many times is the body of the loop executed?

  1. 3 times
  2. 4 times
  3. 5 times
  4. 6 times
Solution The body of the loop is executed 6 times.

Episode 5 exercise 3