Teacher's Guide
Chapter 4 / Level 2: For Loop
Teaching Objective:
- Student learns syntax of a
forloop - Understands how the
forloop is different from awhileloop - Learns use cases and structures for
forloops
Guide
In order to complete the level, the student must use the for loop in order to reach the exit. The for loop allows you to repeat the same code a set number of times. The range() part of the loop code determines how many times the looping code code is run, in the case of the following example it is four.
for x in range(4):
player.move_forward(2)
player.turn_left()
player.move_forward(2)
player.turn_right()
Remember you must indent the code that comes after the loop code in order for it to be part of the loop, otherwise the code won’t loop.
Loop your movements across the hedge maze and reach the exit to complete the level.
Map overview and path

Code Solution
import player
for x in range(4):
player.move_forward(2)
player.turn_left()
player.move_forward(2)
player.turn_right()