Draw a triangle (with a loop)

Challenge Level: Beginner

Learning outcomes

Students will be able to:

Requirement:

Write a program that draws a triangle (with equal sides), starting from point x:0, y:0, with its sides equal to 100 steps. You must use a repeat loop for this challenge.

Testing examples:

There are no testing examples for this challenge.

Languages

Scratch

What it should look like

Click on the green flag to see the expected output of your program.

Recommended blocks
when green flag clicked
clear

pen down

pen up
move (100) steps

turn cw (120) degrees
wait (1) secs

repeat (3)
end
Hints
  • A triangle has 3 sides and 3 angles (all 3 angles always add up to 180 degrees). A equilateral triangle has 3 equal sides and 3 equal angles.
  • Block wait () secs waits specified number of seconds, then continues with next block. To be able to see each sides of the triangle being drawn, use the wait block after turning each angle.

Show Scratch solution

Extra Challenge

Extra challenge #1: Write a program that takes the length of a side of a equilateral triangle (a triangle in which all three sides are equal) as the input, draws the triangle with the given side and displays its perimeter as the output.