Session Details
Week 5,
Session 13 — Mon Apr 12
Reading
-
8.1-8.3
(14 pages)
HW Due
-
HW 12
Topics
-
Hand back and discuss Exam 1
-
Using a debugger
-
Indefinite (while) loops
-
Loop patterns
Outline
-
[10 min] Hand back and discuss exam
-
[14 min] Using the debugger in Eclipse:
- What is debugging? a debugger?
- Typical operations provided by a debugger
- Exercise: use the debugger in Eclipse to find the two bugs in factorialTable.py from the 13-LoopPatterns project
-
[1 min] Running a module conditionally
-
[20 min] Indefinite loops
- How they are different from definite loops
- How they are implemented using a while loop
- Exercise: use the debugger in Eclipse to find the bug in moneyDeposit.py from the 13-LoopPatterns project
- Exercise (how to write a while loop): do the TODO's in findSine.py from the 13-LoopPatterns project
-
[5 min] Break
-
[30 min] Loop Patterns:
- The compute-in-a-loop pattern in its various forms
- The for loop pattern
- The while loop pattern
- Interactive loop
- Sentinel loop using impossible values as the sentinel
- Sentinel loop using no-input as the sentinel
- The loop-and-a-half pattern
- Combined with use of no-input as a sentinel
- The file loop pattern
- Nested loops (next session)
- Wait-until-event loop (next session)
-
[25 min] Exercises on loop patterns, all from the 13-LoopPatterns project (finish for homework):
- guessMyNumber.py
- clickInsideCircle.py
- listMax.py
Resources
-
Slides: Debugging, indefinite (while) loops, and loop patterns
HW Assigned
-
HW 13