In this topic, you will learn how to draw a triangle using turtle graphics.
Follow the instructions below to draw a triangle.
INSTRUCTIONS:
In the IDE to the right, you can see the lines that have forward‘, ‘right‘, forward, ‘right‘ and forward? Let’s add the following numbers into the brackets:
That is one way of drawing a triangle.
The line turtle.forward draws a line the length of whatever number is in its brackets. Meanwhile, the turtle.left and turtle.right turns the arrow the number of degrees that is in-between its brackets.
For our triangle the length is 100 and the arrows turn -120 degrees (but for our maths boffs, the angle inside the triangle is 60 degrees.)