Reminder: for each class session and associated homework:
countPassFail.py module, per the TODO's in the module.
(40 points) Do the exercise in the circleOfCircles.py module, per the following instructions:
Create a function called circleOfCircles that takes five parameters (as described below) and draws n circles whose centers are equally spaced around a (usually) larger circle, as in this example where n is 12:
Note that, as the image shows, you do not actually draw the larger circle that the n circles are spaced around.
The parameters must be as follows, in the order listed:
Additional requirements:
circleOfCircles function must print an appropriate message to the console instead of drawing the “circle of circles.”
circleOfCircles function must print an appropriate message to the console instead of drawing the “circle of circles.”circleOfCircles function should print an appropriate message to the console instead of drawing the “circle of circles.”
if type(n) != int:
# Print the error message to the console
elif:
# ...
We supplied a displayOneCircleOfCircles that main calls to test your circleOfCircles function. The first test will display the example “circle of circles” shown above, if your implementation is correct. You must supply additional tests in main as appropriate.
Finally, note that tracing out a circle is straightforward if you use polar coordinates. For an example of using polar coordinates, see the calculateVertices function in the pizzaPolyStar.py
module:
def
calculateVertices(center, radius, number):
'''Returns a list of 'number'
points evenly spaced around the
circumference
of a circle with the given location and radius.'''
centerX = center.getX()
centerY = center.getY()
# Builds vertices list
vertices = []
for i in
range(number):
x = radius * cos(2 * pi * i /
number) + centerX
y = radius * sin(2 * pi * i /
number) + centerY
vertices.append(Point(x, y))
return vertices
As you finish and test each module, be sure to commit your work to your SVN repository.