Search
Contents
6.
Repeating Things With Loops
6.
Repeating Things With Loops
¶
6.1. Iteration
6.1.1. Don’t Repeat Yourself
6.2.
for
Loops
6.2.1.
for
Loop Syntax
6.2.1.1. Line By Line
6.2.1.2. Begin Counting at 0
6.2.2. Check Your Understanding
6.3. More on
range
6.3.1. Set Start and End Values
6.3.2. Set a Step Value
6.3.3. Try It!
6.3.4. Use Variables in
range
6.3.5. Use Expressions in
range
6.3.6. Check Your Understanding
6.4. Iteration Improves the Turtle Program
6.4.1. How About Drawing Other Shapes?
6.4.1.1. Now Add Variables!
6.5. Loop Through a String
6.5.1. Characters Instead of Integers
6.5.2. Characters Another Way
6.5.3. Check Your Understanding
6.6. Loops With Conditions
6.6.1. Repeating a Check
6.6.2. Looping
if
6.7. The Accumulator Pattern
6.7.1. Keeping a Running Total
6.7.1.1. Adding
1...num
6.7.1.2. Building a String
6.7.2. Reversing a String
6.7.3. Decreasing Total
6.7.4. Check Your Understanding
6.8.
while
Loops
6.8.1.
while
Loop Syntax
6.8.2. Control Flow
6.8.3.
for
Loops Rewritten as
while
Loops
6.8.3.1. Try It!
6.8.4. Input Validation
6.8.5. Which Loop To Use?
6.8.5.1.
for
Pros and Cons
6.8.5.2.
while
Pros and Cons
6.8.6. Check Your Understanding
6.9. Infinite Loops
6.9.1. Coding Infinity
6.9.2. Fun Fact
6.9.3. Check Your Understanding
6.10. Ending a Loop With
break
6.11. Exercises: Loops
6.11.1.
for
Practice
6.11.1.1. Bonus
6.11.2.
while
Practice
6.11.3. The Accumulator Pattern
6.12. Project: Turtle Loops
6.12.1. Part A - Polygons and Sprites
6.12.2. Part B - Clock Face
6.12.3. Part C - Nested Loops
6.12.4. Part D - Polygons With Sprites
6.12.5. Part E - Draw Something New
←
5.11.
Project: Conditional Launch
6.1.
Iteration
→