How to draw a square

In this topic, you will learn how to draw a square using turtle graphics.

Follow the instructions below to draw a square.

INSTRUCTIONS:

  1. In the IDE to the right, you can see the lines that have ‘forward‘ and the lines that have ‘left‘?
  2. In the brackets next to the forward put the number 100 in-between i.e. turtle.forward(100)
  3. In the brackets next to the left write the number 90 in-between i.e. turtle.left(90)
  4. Click the Run button

That is one way of drawing a square.

The line turtle.forward draws a line the length of whatever number is in its brackets. Meanwhile, the turtle.left turns the arrow whatever number of degrees that is in-between its brackets

For our square the length is 100 and the angles are 90 degrees.

CHALLENGE:

Try and draw a rectangle. What would the length be? Would the angles still be the same? Edit the code above and click RUN to see if you get it right.