CS 170 Lab 6: Turtle Graphics

This is a lab exercise that has you controlling Turtle graphics and doing some numeric calculations.

Start up Idle and open the file polyturtle.py. This file has the definitions of triangle and square functions that we saw in class on Monday. The main program has been simplified to call those two functions, drawing the two shapes on top of each other. Run the Module to see this happen and make sure the graphics stuff is working for you.

Write a new function called polygon that takes two parameters, length (the length of a side) and sides (the number of sides the polygon should have). This function should work similarly to the given functions, but it will need to calculate the angle itself. Modify your main program to call polygon(100,5) and polygon(100,12) to see it draw a regular pentagon and a regular dodecagon

Write another new function called circ (the word circle is already taken) that takes just one parameter, called radius. We will approximate a circle by drawing a polygon with 360 sides, where the side length can be calculated as 2*pi*radius / 360. Again modify your main program to call this function with a radius of 50.

When your program is working properly you should upload it to the class web site. Make sure your file has your name and Lab 06 prominently displayed on it.