Drawing polygons in python turtle

Dave Angel davea at davea.name
Tue Feb 11 01:00:52 CET 2014

 geniusrko at gmail.com Wrote in message:
> Hi
> can anyone help finding the angle to draw different polygons shapes
> in this example 
> import turtle 
> wm = turtle.Screen()
> alex = turtle.Turtle()
> for i in range(5):
>     alex.left(216)
>     alex.forward(50)
> wm.exitonclick() 
> Why do we use 216

216 degrees doesn't seem to me that it would make a polygon, but
 rather a star.

I can tell you what I remember about geometry, however. To make a
 regular polygon,  you need to turn by a fixed amount and go a
 fixed distance each time. 

For an equilateral triangle,  you turn 120 degrees. For a square, 
 90. For a pentagon,  108.

180 - (360/n) degrees.


More information about the Python-list mailing list