English · Dansk · Bahasa Melayu
Turtle Challenges
The five turtle graphics challenges of day 18, as a small and tested Python package.
What is it?
Day 18 of the Udemy course 100 Days of Code: The Complete Python Pro Bootcamp, on turtle graphics. The package solves the five challenges of the lecture: draw a square, draw a dashed line, draw different shapes, generate a random walk and draw a spirograph. Each challenge is a function that keeps the name from the assignment and takes the turtle as its first argument, so the tests can run without a window. You start one challenge by name with the turtle-challenges command.
What the exercise teaches
- Moving and turning the turtle to draw lines and shapes
- Drawing with loops, with a pen that goes up and down for the dashes
- Picking random colors as RGB tuples and random directions
- Passing the turtle as a parameter, so the code can be tested with a recording fake instead of a window
What it does
- Five challenges started by name:
square, dashed-line, shapes, random-walk and spirograph
- The assignment's function names
draw_square, draw_dashed_line, draw_shape, random_walk and draw_spirograph
- A
--gap option for the spirograph
- No runtime dependencies beyond the Python standard library
Next