Activity: For Loop
I'M FINISHED WITH HOUR OF CODE!
img

We can make the turtle 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.

sprite.pen_down() for counter in range(2): # add code here sprite.move_forward(250) sprite.turn_left(90)
Support