Week 3 syllabus map
L3.1: IntroductionL3.2: Introduction towhileloopL3.3:whileto compute factorialL3.4: Tutorial onwhileloopL3.5: Introduction toforloopL3.6:forloop to add the firstnnumbersL3.7:forloop for multiplication tablesL3.8: More onrangeandforloop withoutrangeL3.9: Formatted printingL3.10: Tutorial onforloop and difference betweenwhileloop andforloopL3.11: NestedforloopL3.12: Tutorial on nested loopsL3.13:break,continueandpassL3.14: Conclusion
Week 3 lecture pages
- L3.1: Introduction
- L3.2: Introduction to while loop
- L3.3: While to Compute Factorial
- L3.4: Tutorial on while loop
- L3.5: Introduction to for loop
- L3.6: for loop to add the first n numbers
- L3.7: for loop for multiplication tables
- L3.8: More on range and for loop without range
- L3.9: Formatted Printing
- L3.10: Tutorial on for loop and difference between while loop and for loop
- L3.11: Nested for loop
- L3.12: Tutorial on nested loops
- L3.13: break, continue and pass
- L3.14: Conclusion
30-minute pacing suggestion per lecture
0-8 min: concept and syntax8-18 min: dry runs and step-by-step trace18-25 min: exam traps and error patterns25-30 min: quick practice + answer check
Week 3 exam traps (must master)
- infinite
whileloop due to missing update - off-by-one boundaries in
whileandfor - confusion between
range(n),range(1, n), andrange(1, n + 1) - confusing
whileandforuse-cases - nested-loop indentation and variable shadowing mistakes
- factorial base case (
0! = 1) - misunderstanding
breakvscontinuevspass - using
+for strings vs numbers in formatted printing - wrong alignment/width in f-strings (
:>,:<,:^)
Final revision checklist
- can trace loop variables manually
- can predict output without running code
- can convert simple
whilelogic toforand vice versa - can write table output with clean formatting
- can explain why a loop stops
