CPSC150AScientific Computing

Activity 1

Introduction

diamond

Write a Python program that uses turtle graphics to draw a diamond.

Example

### Practice Problem #2

Write a Python program that uses turtle graphics to draw a square that is centered in the window.

Example

### Star

One of the first shapes you learned to draw in grade school was probably a star. It is a pretty easy shape to draw, looks pretty cool, and can be done entirely with straight lines. The only tricky part is determining how to go from one point of the star to the next. Today, you will figure that part out.

Details

Write a Python that uses the turtle module to draw a five-pointed star.

Example

#### Hint

• Drawing the star is much easier if you use the functions forward and either turtle.left or right.

• Note that the turtle will need to turn once for each point of the star and that it will turn a total of 720°. So, you can calculate the number of degrees in each turn.

• Finally, drawing the star is simply alternating between moving forward and turning.

Submission

Please show your source code and run your programs for the instructor or lab assistant. Only a programs that have perfect functionality will be accepted as complete.