Learning objectives for chapter 7
Learn to use else-if logic to select from among several sets of statements depending on conditions being met.
Learn the difference between event-controlled and count-controlled loops, and how to implement each.
Learn how to implement for-loops.
Learn what are nested loops and how to manage them in a program.
Learn how to reverse logic by applying DeMorgan's Theorem.
  Learning objective(s) addressed
  12345
Exercises Right-click (or control-click on a Mac) the title to save its PDF to your system.  
7.1 Eise-If Logic PDF X    
7.2 Input Validation PDF  XX  
7.3 Making Change While PDF  XX  
7.4 Coin Toss, v.2.0 PDF  XX  
7.5 Coin Toss, v.3.0 PDF  XXX 
7.6 The Game Of War, v.2.0 PDF XX   
7.7 The Game Of War, v.3.0 PDF XX X 
7.8 The Rock-Scissors-Paper Game, v.1.0 PDF XX X 

 
Samples Right-click (or control-click on a Mac) the title to save its PDF to your system.  
7.1 About For-loops PDF   X  
7.2 About Nested Loops PDF    X 
7.3 About DeMorgan's Theorem PDF     X

 
Videos  
7.1 Click HERE for a YouTube-like video that shows how to develop code with loops. It's 20 minutes long, using Python with the JNotePad editor and the Visual Studio command line compiler, on a Windows PC. It demonstrates the development of a program that uses an event-controlled, while-true-if-break loop, with else-if logic. XX   
7.2 Click HERE for a YouTube-like video that shows how to develop the MasterMind game "from scratch". View the video to see how a problem similar to Rock-Paper-Scissors is developed. It's 70 minutes long, using Python with the JNotePad editor and the g++ XCode command-line compiler on a Mac. It demonstrates the development of a program that uses an event-controlled, while-true-if-break loop, with else-if logic. XX   

Code from the chapter in order of their appearance in the text
True-False Logic WITHOUT Else True-False Logic WITH Else grades.py compare2Numbers.py
A Count-Controlled Loop A While-Condition Loop bounce.py thereYet2.py
bounce2.py countFromZero.py backwards.py Finding The Max/Min Value Using Loops
rightTriangle.py pyramid.py diamond.py digitalClock.py
redGreen.py redGreen2.py    

Chapter 1 | 2 | 3 | 4 | 5 | 6 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15