CS110: Fall 2021

Intro to Computer Programming with Python

CS110: Fall 2021

Lessons > 12. While Loops

In this lesson, we’re going to go over while loops – a way of allowing your program to repeat code for a specified number of iterations. Being able to repeat code blocks (also know as “looping” or “iterating”) is very powerful, and will allow you to easily perform repetitive tasks in a variety of different contexts: playing songs, drawing pictures, building animations, doing data processing, and so forth. I also highly recommend that you read Chapter 5 in the Severance (Python for Everyone), for additional review.

Today's Activities

For today, please do the following:

1. Download the Exercise Files

Exercise Files

2. Review the Slides

  1. Repeating Tasks with Code: While Loops
  2. Supplementary Slides for Live Lecture

3. Watch the Lecture Video(s)

Link Title Type Duration
Video 1 Introduction to loops pre-recorded 9:07
Video 2 While loops example pre-recorded 15:51
Video 3 Loops & Lists pre-recorded 22:04
Video 4 Practice with logical and comparison operators; while loops lecture 50:35

4. Review / Study the Supplemental Materials

Note: these readings / videos are suggested for additional context / examples, but not required.

  1. Severance Ch5: Iteration.
    readingvideo
  2. Ch7: Iteration. ThinkCS