STEP 8: We can make the hedgehog move the same distance using only 3 lines of code!

For Loops let you repeat a certain group of commands more than once.

The number in range() determines how many times the loop repeats.

  • The loop below only repeats 2 times. Change the for loop so that it repeats 4 times and completes the maze.``

To navigate the page using the TAB key, first press ESC to exit the code editor.

sprite.pen_down() for counter in range(2): # add code here sprite.move_forward(5) sprite.turn_right(90)
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)