That last piece of code is actually a pattern for a wide variety of geometric shapes. Hereโs the code to draw a triangle. It may not be obvious why we turn 120 in this program, but it will be soon.
The Total Turtle Trip Theorem states that the turtle will draw a closed figure with n sides when the sum of the angles turned is a multiple of 360. In the triangle example, 3 \times 120 = 360 and in the pentagon example, 5 \times 72 = 360.
Change the ?? in line 7 below to the amount to turn each time to draw a 12-sided polygon, which is called a dodecagon. If you get it right the turtle will draw a 12-sided closed polygon.