CSCI 13300 SP 2025

Go to homepage

Last updated: 2025-03-22

Unit 9 Assessment

Due date and submission

This assignment is due April 5th at 11:59 PM. Submit your solution on Brightspace, under the “Unit 9” assignment.

Please copy your code into the text box, making sure to indent it properly with whitespace so that it appears the same as in IDLE or wherever you wrote the code. This will make it easier for me to grade.

You can submit multiple times. I will only grade your last submission.

Task

In this task, you will write a function draw_ngon_triangles(n) that works like this:

draw_ngon_triangles(10)
draw_ngon_triangles(5)
draw_ngon_triangles(25)

As you can see above, the function draws a regular n-gon (a regular polygon with n sides), and fills the constituent triangles (formed with a side on the perimeter, and the center point) with colors that go from white to black.

In the below diagram, angle \angle A is what is described below as the “center” angle, and angle \angle B is what is described as the “outer” angle.

Annotated version of draw_ngon_triangles(5)

Some turtle functions that you should use (you shouldn’t need anything besides these):

Notes

You should be able to do all of the tasks with only the Python topics we covered in class so far.

If you want to use more complex functionality than what we discussed in class, the Python documentation may be helpful: Python 3.10 documentation

Additionally, the Python turtle documentation may be helpful: Python 3.10 turtle documentation