Title: Drawing Regular Polygons Part 2

Topic: Geometry

Difficulty:

Required Skills: Defining Functions, General Formula for Angle Sum of Polygon, Exterior Angles

Language: Python

This activity extends the students learning to writing a function that accepts the number of sides as an input and will draw the correct regular polygon. It requires students to have an understanding of defining functions in Python and for them to apply the general formula for the interior angle sum of regular polygons.

from turtle import *

speed(
100)
hideturtle()

def polygonDrawer(n):
 
for x in range(n):
   forward(
50)
   left(
180 - 180*(n-2)/n)
 
for x in range(3,20):
 polygonDrawer(x)