5. Loops Practice Quiz and Assignment Work Period

Quick Overview of Day

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

5.1. Practice Problem

../../_images/confusion-17.png

Draw the shape above. You can choose to either:

  • create a function, and repeatedly call that function

  • use repetition without a function (if you choose this method, you will want to use a nested for loop)

5.2. What Does This Program Do?

Note

Your teacher may choose to use the following examples as a class activity, by displaying the examples, and having you take a guess as to what you think each will do before running the code.

What will the following programs output? Why?

5.3. Loops Practice Quiz

To confirm that you understand for and while loops, you should try the Loops Practice Quiz using only your brain (in other words, try to figure out what will happen without running the code).

5.4. 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 - 1. Fruitful Functions and Variable Scope