Add draw_spirograph with tests

Draws int(360 / size_of_gap) circles, each in a random RGB color, turning the heading
by the gap after each. A gap that is not positive raises ValueError, and the integer
count avoids the TypeError that range raises for a float.

Task: MIL-004#2
Task: MIL-004#3
This commit is contained in:
2026-10-07 23:59:12 +08:00
parent 949d2edb63
commit 2328490945
4 changed files with 170 additions and 3 deletions
+6 -3
View File
@@ -3,10 +3,11 @@
@brief Solutions to the turtle graphics challenges of day 18 of Udemy's
100 Days of Code.
The challenges so far are @ref turtle_challenges.square.draw_square,
The five challenges are @ref turtle_challenges.square.draw_square,
@ref turtle_challenges.dashed_line.draw_dashed_line,
@ref turtle_challenges.shapes.draw_shape and
@ref turtle_challenges.random_walk.random_walk. Each takes the turtle as its
@ref turtle_challenges.shapes.draw_shape,
@ref turtle_challenges.random_walk.random_walk and
@ref turtle_challenges.spirograph.draw_spirograph. Each takes the turtle as its
first argument, so it can be tested without a window.
"""
@@ -14,12 +15,14 @@ from turtle_challenges.colors import random_color, random_palette_color
from turtle_challenges.dashed_line import draw_dashed_line
from turtle_challenges.random_walk import random_walk
from turtle_challenges.shapes import draw_shape, draw_shapes
from turtle_challenges.spirograph import draw_spirograph
from turtle_challenges.square import draw_square
__all__ = [
"draw_dashed_line",
"draw_shape",
"draw_shapes",
"draw_spirograph",
"draw_square",
"random_color",
"random_palette_color",