4. Turtle Drawing Practice

Quick Overview of Day

Use for loops and functions to draw shapes elegantly. Continue working on a Python turtle graphics assignment, focused on repetition and conditionals.

4.1. Practice Problems

4.1.1. Inner Squares


Define a function similar to draw_square(my_turtle, side_length) and call it twice to draw the shape above. You may find it helpful define a new version of of this function, instead of reusing the one from yesterday. Perhaps you might not start in the same location as we did the last time we drew a square?

For the first three problems, beginning your drawing from the middle of the square, then ending in the middle of the square (facing the same direction as you started) can be a really helpful strategy. You might want to create a function such as draw_square_from_centre(the_turtle, side_length) that does this. This new function could even call your old draw_square(my_turtle, side_length) function, if you’d like.

4.1.3. Overlapped Squares


Draw the shape above. Depending on how you defined your earlier function(s) in the problems aboves, you may be able to easily use reuse your function(s).

4.1.4. Bonus - If You Are Done Before Others


Draw the shape above. Think carefully about how you might be able to draw this elegantly (efficiently and readably)! Creating an adapted version of one of your previous functions isn’t a bad idea…

4.2. Turtle Graphics Assignment

Use the rest of this class time to keep working on your current Python assignment (possibly a turtle graphics drawing, with a focus on looping and conditionals).

Next Section - 5. Loops Practice Quiz and Assignment Work Period