Skip to main content

Week 3 concept checklist

You should now be confident with:
  • while loop flow and update logic
  • factorial and digit-processing with loops
  • for loop with range
  • direct iteration without range
  • nested loops for patterns and tables
  • break, continue, pass
  • formatted printing using f-strings

High-value exam traps

  • off-by-one in range boundaries
  • wrong step sign in range causing empty output
  • missing loop-variable update in while
  • continue skipping update and creating infinite loop
  • confusing pass with continue
  • forgetting 0! = 1
  • formatting mismatch: string with numeric format code

Integrated mixed practice

  1. Compute factorial using while.
  2. Compute sum of first n numbers using for.
  3. Print 3x4 star grid using nested loop.
  4. Print odd numbers 1 to 15 using continue.
  5. Stop loop at first value divisible by 9 using break.
  6. Print table of 6 with alignment:
 6 x  1 =   6
 6 x  2 =  12
...

Mixed MCQ drill

  1. Output?
for i in range(1, 5):
    print(i, end=' ')
  1. Output?
i = 1
while i < 4:
    i += 1
print(i)
  1. Which keyword skips current iteration only?
  2. Which loop is better for iterating over string characters?
  3. range(5, 1, -1) gives what values?

Answers

  1. 1 2 3 4
  2. 4
  3. continue
  4. for
  5. 5, 4, 3, 2

Next-step suggestion

Before Week 4:
  • solve 20 output-prediction questions on loops
  • write 10 pattern programs from memory
  • dry-run at least 5 nested-loop snippets by hand