CPSC120A
Fundamentals of Computer Science I

Post-lab 7

Repetition

A Spirograph is a toy that helps kids create designs out of curves. The Spirograph mounts a pen in a series of gears that when actuated create mesmerizing geometric curving designs. In this post-lab you will demonstrate your understanding of loops by using the turtle module to draw a line spiralgraph.

Details

Create the function draw_spiralgraph(line_length) in a file called spiralgraph.py. The parameter line_length specifies the length of the lines used to draw the spiralgraph. There are many turn angles that will create beautiful spiralgraph drawings. Try different angles and pick one you like. The number of times the function draws lines should the fewest needed to draw a complete the spiralgraph for the angle you have chosen. Test your function by calling the function multiple times with different parameters. Make sure your code follows the courses code conventions.

Example

turtle.up()
turtle.goto(-200, 0)
turtle.down()
turtle.color('red', 'yellow')
turtle.begin_fill()
draw_spiral(200)
turtle.end_fill()
turtle.up()
turtle.goto(0, 0)
turtle.down()
turtle.color('thistle', 'peachpuff')
turtle.begin_fill()
draw_spiral(200)
turtle.end_fill()
Turtle Graphics Spiralgraph

Submission

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