[We hope that you can view the videos! However, if your internet connection is too slow for viewing videos, download the audio file (mp4) and the slides (pdf). Then you can listen to the audio as you go through the slides.]
while loopWe do some live coding today and discuss some search algorithms that all feature the use, and the usefulness, of while loops.
Slides for all 3 videos of this lecture: individual slides for viewing and a "6-up" version for printing.
Note that Part 3 (the third video) is optional extra material--look at it if you are interested in learning about search algorithms but it is not required.
We revisit the word guessing game developed in Lecture 21.  This time we use a while loop to repeatedly allow the user to guess and to process the guesses.  Practice writing while loops as well as working with classes.
SecretWord from Lecture 21:  wordGuess.pywhile loop to check user inputInstead of assuming that the user provides appropriate input, we can check the input and re-prompt the user as many times as necessary!  A while loop is super useful for this.
game_while from Part 1
  whileWe briefly introduce the linear search and binary search algorithms.  Linear search can be used to search for the first occurence of an item in a list.  Use binary search when you are searching through a sorted list.  Here we simply look at these algorithms as examples of the use and usefulness of while loops.  If you will take the next programming course (CS 2110) later, you will learn much more about the algorithms, different implementations, and analysis.