We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Loops Practice

As a reminder, a "for loop" in Python is written like this:

for i in range(0, 10):
    print(i)

In English, the code says:

  1. Start with i equals 0. (i in range(0))
  2. If i is greater than or equal to 10 (range(0, 10)), exit the loop.
  3. Print i to the console. (print(i))
  4. Add 1 to i. (range defaults to incrementing by 1)
  5. Go back to step 2

The result is that the numbers 0-9 are logged to the console in order.

Whitespace Matters in Python!

The body of a for-loop must be indented; otherwise, you'll get a syntax error.

Assignment

In the print_numbers_from_five_to function, the for-loop starts at 0. It should start at 5. Only change the start.