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.
CS20-CP1 Apply various problem-solving strategies to solve programming problems throughout Computer Science 20.
CS20-FP1 Utilize different data types, including integer, floating point, Boolean and string, to solve programming problems.
CS20-FP2 Investigate how control structures affect program flow.
CS20-FP3 Construct and utilize functions to create reusable pieces of code.
CS20-FP4 Investigate one-dimensional arrays and their applications.
5.1. Practice Problem¶
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).