CPSC120A
Fundamentals of Computer Science I

Post-lab 5

Turtle Graphics

In this post-lab you will demonstrate your understanding of the turtle module by creating a simple drawing.

Details

Create a Python program that uses the turtle module to draw an equilateral triangle that is centered in the window. You can choose any size and orientation for the triangle, but the length of every side must be the same. In order to center the triangle you will need to calculate the height of the triangle. The height of the triangle can be calculated witht the following equation:

$$h = \frac{l \cdot \sqrt{3}}{2}$$

Where \(h\) is the height of the triangle and \(l\) is the length of a side of the triangle. The program should use variables and arithmetic expressions where appropriate and follow the course's code conventions.

Example

$ python3 triangle.py
Turtle Graphics Triangle

Submission

Submit your program as a .py file on the course Inquire page before class on Wednesday September 10th.