S3 ICT | Python Programming Basics — Lesson-Prep Guide for Tutors | Variables, input Conversion, range and Dry Runs
- 2026-11-11
Students can print a line but cannot say why total becomes 55. The problem is not syntax; they have no picture of a value changing each pass. One dry-run table turns the loop from a spell into a traceable procedure.
01 Prerequisites (3-minute check)
If any of these fails, fix it before the lesson starts.
| Skill | Quick check | Pass mark |
|---|---|---|
| Integers and averages | What is 1 plus 2 up to 10, and the average? | 55 and 5.5 |
| Keywords | What do for and while each imply? | for walks through values; while repeats while a condition holds |
| Assignment direction | Which is legal, a = 3 or 3 = a? | The first; the equals sign puts the right value into the left name |
02 Lesson flow (45 minutes)
| Time | Stage | Tutor does | Student does |
|---|---|---|---|
| 0-5 min | Estimate first | Ask what total is after ten passes of total = total + i; write the guess down. | Most guess 10 or 100, revealing no value trace |
| 5-13 min | A variable is a label | Show a = 1 then a = a + 1, stressing the right side is computed first. | Write the value of a twice |
| 13-26 min | The range boundary | Write range(1, 11) and range(10), list both, note the right boundary is excluded. | List both sets of numbers |
| 26-34 min | Dry-run table | Draw columns for i and total and fill ten rows to reach 55. | Fill three rows themselves |
| 34-41 min | Two error types | Show the effect of a missing int() and of range(1, 10), then fix each. | Explain the difference |
| 41-45 min | Exit check | Collect three answers and mark them on the spot. | Hand in three answers |
03 Teaching script (read it out)
Scene 1: Act 1: the equals sign attaches, it does not compare
Compute the right side, then attach it to the left; every pass changes it.
Scene 2: Act 2: the right boundary of range is excluded
range(1, 11) is 1 to 10; the right boundary is excluded, which causes off-by-one.
Scene 3: Act 3: the dry-run table is the fastest debugger
Copy i and total pass by pass; the wrong pass is visible at once.
04 Question types and worked steps
| Type | Example | Steps | Answer |
|---|---|---|---|
| Predict the output | total = 0; for i in range(1, 6): total = total + i; print(total) | (1) List what range produces (2) Add pass by pass (3) Verify with the formula | 15 (1+2+3+4+5); the formula (1+5) times 5 divided by 2 also gives 15 |
| Find the error | n = input(“Number: “); print(n + 1) raises an error. Why? | (1) Check the type returned by input (2) Name it as a string (3) Wrap with int() (4) Mention validation | input returns a string and a string cannot be added to an integer; use int(input(…)) |
| Dry-run table | x = 3; while x > 0: print(x); x = x – 1 | (1) Write the condition (2) List x each pass (3) Say when it stops | 3, 2, 1; when x reaches 0 the condition 0 > 0 is false and the loop stops |
| Write a program | Read five scores and print the average. | (1) Loop five times (2) Convert each with int() and accumulate (3) Divide by five (4) Round the result | total = 0; for i in range(5): total = total + int(input()); print(round(total / 5, 2)) |
05 Independent practice (3 questions)
| Question | Answer | What to watch |
|---|---|---|
| What is total after total = 0; for i in range(1, 101): total += i? | 5050 | Checked with (1+100) times 100 divided by 2 |
| Why does print(“5” + 1) fail while print(int(“5”) + 1) works? | String plus integer is a type mismatch; the second converts first | Names the type rather than just saying “add int” |
| Write an infinite while loop, then fix it. | Condition always true, e.g. x = x + 1 with condition x > 0; fix by decrementing | States that the condition must eventually become false |
06 Common mistakes and what to say
| Mistake | Student writes | Say this |
|---|---|---|
| Forgetting int() | “n = input(); print(n + 1)” | “input gives you text, not a number. Text plus one is an error. Convert with int() first and the program runs.” |
| range off-by-one | “range(1, 10) means 1 to 10.” | “The right boundary is excluded. range(1, 10) gives nine numbers and totals 45. For ten numbers write range(1, 11).” |
| Inconsistent indentation | “Some lines in the loop body use two spaces, some four.” | “Python uses indentation to decide what is inside the loop. Align the same level or the computer reads it as two separate things.” |
| Using = for comparison | “if x = 5:” | “A single equals assigns; comparison needs two. That line raises a syntax error before it runs.” |
07 Homework (paper, section and question numbers)
- Dry-run the 1 to 10 loop and fill all ten rows — Python basics chapter, practice 1
- Rewrite the average program to read any number of scores — Python basics chapter, practice 2
- Check 1 to 100 with the formula and confirm 5050 — Python basics chapter, practice 3 data row
08 Exit check (last 5 minutes)
| Question | Answer | Decision |
|---|---|---|
| How many numbers does range(1, 11) produce? | Ten, from 1 to 10 | Wrong: reteach Act 2 |
| What is 1 plus 2 up to 10? | 55 | Wrong: reteach Act 3 |
| What type does input() return? | A string (str); convert with int() or float() before arithmetic | Wrong: reteach Act 1 |
09 Tutor FAQ
Teach for or while first?
for first, because the count is explicit and easy to trace; bring in while when the number of passes is unknown.
Do students need to memorise syntax?
Only print, input, int, range, if and for; the real skill is tracing values and debugging.
Why insist on a dry-run table?
Because working code with the wrong answer is common, and only a value trace shows whether the fault is a boundary, a type or indentation.
Find a tutor — freeTutor Registration →
A TutorZone lesson-prep guide. Written by the TutorZone team; questions and lesson flow are original and are not taken from any school or publisher material.


