# Pentagram Challenge A polygon is a plane shape (2D) with straight lines. It consists of vertices and edges.

A polygon is regular when all angles are equal and all sides are equal. For instance a regular pentagon consists of 5 vertices and 5 edges of equal size. The vertices of a regular pentagon are equally spread on a circle. This outside circle is called a circumcircle, and it connects all vertices (corner points) of the polygon. The radius of the circumcircle is also the radius of the polygon. We can use the trigonometric formulas to work out the (x,y) coordinates of each vertex of a regular pentagon. (See picture on the right).

Using this approach, we can use a Python script to calculate the (x,y) coordinates of the 5 vertices of a regular pentagon and store them in a list of [x,y] sub-lists.

```pentagon=[]
R = 150
for n in range(0,5):
pentagon.append([x,y])```

#### Star Shapes A pentagram is a polygon that looks like a 5-pointed star. The outer vertices (points of the stars) form a regular pentagon. The inner vertices of the star also form a smaller “inner” regular pentagon.

We can hence use a similar approach to calculate the (x,y) coordinates of both “outer” and “inner” vertices of our pentagram. #### Python Turtle

We have completed the code to calculate the coordinates of a regular pentagon (using the code provided above) and have created a function called drawPolygon() that uses Python Turtle to draw a polygon on screen.

Adapt the above Python code to calculate the coordinates of all the vertices of a pentagram (star shape) and draw the pentagram on screen.

The output of your program should be as follows: Use the shoelace algorithm to calculate the area of your pentagram. #### Solution...

The solution for this challenge is available to full members!
Find out how to become a member:

Did you like this challenge?

Click on a star to rate it!

Average rating 4.8 / 5. Vote count: 5

No votes so far! Be the first to rate this post.

As you found this challenge interesting...