/en-tutor-prep-s4-ict-python-programming/
/en-tutor-prep-s4-ict-python-programming/
英文版
3
General Inquiry: info@TutorZone.com.hk
Office Hours: Monday to Saturday - 9:00 AM to 6:00 PM
WhatsApp Monday to Sunday - 24 hours
Hotline: +852 6828 1809
Instant Support: +852 9061 3106

DSE ICT | Python Programming Basics: Tutor Lesson Plan

DSE ICT | Python Programming Basics: Tutor Lesson Plan

  • 2026-11-03

Students follow a demo easily and then forget a colon, lose the indentation or type one equals sign. This lesson drills three things only: trace the variables, guard the conditions, count the loop rounds, and then ties all three together with the sum from 1 to 100.

Objectives — Students can: (1) write a loop that sums 1 to 100 and returns 5050, checked against n(n+1)/2; (2) grade the list 45, 52, 68, 39, 71 with if and elif and count three passes; (3) compute the mean of 55.0; (4) explain that range(3) yields 0, 1, 2 and that indentation decides what sits inside the loop.

01 Prerequisites (3-minute check)

If any of these fails, fix it before the lesson starts.

Skill Quick check Pass mark
Variables After x = 5 then x = x + 1, what is x? 6
Comparison How do == and = differ? One compares, one assigns
Integer division What is 7 // 2? 3
Output What does print(3 + 4) show? 7

02 Lesson flow (60 minutes)

Time Stage Tutor does Student does
0-8 min Opening Ask how to make a computer add 1 to 100 Name the loop and the formula
8-20 min Variables and sequence Start the accumulator at zero Write the three accumulator lines
20-32 min Selection Grade marks with if and elif Add every colon themselves
32-44 min Loops The bounds of range Explain why range(1, 101) is needed
44-52 min Functions and debugging Wrap the mean in a function Find the indentation fault
52-60 min Independent practice Three questions in eight minutes Mark the errors and name the cause

03 Teaching script (read it out)

Scene 1: Trace the variables before writing the second line

The accumulator must start at total = 0, then run total = total + i inside the loop. Students forget the initialisation and get a name error, or put it inside the loop so the answer always equals the last value. Method: before touching the keyboard, make them draw two columns for i and total and run three rounds by hand. That habit reappears in every sum, count and maximum question later in the course.

Ask for three rounds of i and total written by hand.

Scene 2: The range end is excluded and indentation decides the block

range(1, 101) includes 100, while range(1, 100) returns 4950. Indentation is the second trap: indented lines sit inside the loop, unindented lines run after it. When a student asks why the total only shows the last value, the answer is always the indentation. Demonstrate by moving the print in and out of the loop, since seeing the change beats repeating the rule.

Ask for the total of range(1, 100) and why it is not 5050.

Scene 3: Check the loop with the formula and the selection with test cases

The 5050 question is good because a second route exists: n(n+1)/2 also gives 5050, so two agreeing routes mean the loop is right. Selection needs test cases instead: 45 must fail, 52 must pass, 71 must reach the top band, and all three must hold before the code is done. Train the reflex question of how I know it is right, which is exactly the debugging mark in the exam.

Ask for the formula check on 100 and one test case that proves the if works.

04 Question types and worked steps

Type Example Steps Answer
Accumulation Sum from 1 to 100 Set total to zero, loop over the range, add each i 5050
Selection Turn a mark into a grade Order conditions from high to low, add colons, test each case 71 reaches the top band
Counting How many of 45, 52, 68, 39, 71 pass Start a counter, test the threshold, print the counter 3
Mean value Mean of five marks Sum, divide by length, round to one decimal 55.0
Sanity check (teach this): Size check: the sum from 1 to 100 must beat 100 and stay under 10000, so 100 means one round only and 4950 means 100 was dropped. The mean must lie between the lowest mark 39 and the highest 71, so 275 means the division was skipped. Counter check: a count can never exceed the list length of five, so a six means the comparison or the else branch is wrong.

05 Independent practice (3 questions)

Question Answer What to watch
Sum of the even numbers from 1 to 20 110 Was the modulo test used
Which numbers does range(3) produce 0, 1, 2 Assumed it starts at one
How many of 45, 52, 68, 39, 71 reach 50 3 Treated 50 as a fail

06 Common mistakes and what to say

Mistake Student writes Say this
One equals sign in a condition “if mark = 50: will test the mark” “A single equals sign assigns, so 50 is pushed into mark; a comparison needs two.”
Wrong indentation “print(total) behaves the same outside the loop” “Outside it prints once at the end; inside it prints every round, which is what you wanted.”
Range boundary “range(1, 100) counts up to 100” “The end of a range is excluded, so 100 is missing and the total is 4950.”
No initialisation “Start straight at total = total + i” “total is undefined, so the computer has no starting value; set total to zero first.”

07 Homework (paper, section and question numbers)

08 Exit check (last 5 minutes)

Question Answer Decision
Sum from 1 to 100 5050 Error: 4950 from a missing 100
Numbers from range(3) 0, 1, 2 Error: assumed 1, 2, 3
Mean of 45, 52, 68, 39, 71 55.0 Error: division by the count skipped
How many marks reach 50 3 Error: 50 treated as a fail

09 Tutor FAQ

When do we use for and when while?

Use for when the number of rounds is known and while when a condition ends the loop; either can be rewritten as the other, but choosing well keeps code readable.

Why does Python rely on indentation?

Indentation is the syntax that marks a block, so a stray space changes behaviour; use four spaces consistently and never mix tabs.

Which language does the DSE paper use?

The syllabus asks for logic in pseudocode or a high level language and schools mostly use Python; write input, process and output as three clear steps.

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.

Join as a tutor or coach — academic, music, sports, arts, STEM. Free to register. See how it works →