Skip to content

Lesson 3: Loops and the pen

Draw with the pen

  • The robot has a pen under it. pen.move(DOWN) puts it on the floor; the robot then draws a line where it drives.
  • pen.move(UP) lifts it again. pen.set_pen_color(RED) changes the colour (BLACK, RED, GREEN or BLUE).

Words for this lesson

Word Meaning
pen draws a line on the floor under the robot
loop code that runs again and again
range(4) count 4 times: 0, 1, 2, 3
indent the spaces before a line inside the loop

Log in or create account

IGCSE, A-Level & AP