Sparklabs Learning / Digital Technology
SS 3 First Term
Week 2: Advanced Programming
- School
- Creative Brains Academy
- Subject
- Digital Technology
- Pack
- Curriculum only
- Prepared
- 7 November 2026
Week index
- 01Senior Review and Computational Problem Solving
- 02Advanced Programming
- 03Functions, Arrays and Data Structures
- 04Object-Oriented Programming
- 05Database Systems
- 06Computer Networks and Internet Technologies
- 07Web Development and Web Design
- 08Software Development Life Cycle
- 09Electronic Commerce
- 10Cyber Security and Emerging Digital Technologies
- 11Revision
- 12Examination
Week 2 / First Term
Advanced Programming
Monday 14 September 2026 to Friday 18 September 2026
Curriculum outline
Lesson objectives
By Friday, candidates should be able to:
- Trace a validated while loop.
- Handle ValueError with try and except.
- Convert input with float().
- Compute subtotal, VAT and total.
- Test text and negative input.
Key vocabulary
- Iteration: one pass through a loop.
- Validation: checking input against an accepted rule.
- Exception: an error raised during execution.
- Accumulator: a variable holding a running total.
- Cast: converting a value between types.
Common misconceptions
- "A while loop always runs once." It runs zero times when the condition starts false.
- "input() returns a number." It returns text; float() converts it.
Teacher activities
- Starter: trace a three-step loop.
- Teach read, convert, test, accept.
- Model try and except.
- Build the receipt program.
- Run five test inputs.
- Collect error logs.
Student activities
- Complete the starter trace.
- Copy the four-step order.
- Force one ValueError.
- Assemble the program.
- Record five outputs.
- Add a discount above 2000.
total = 0
count = 0
while count < 3:
try:
price = float(input("Price: "))
except ValueError:
continue
if price > 0:
total = total + price
count = count + 1
print("Subtotal:", total)
print("VAT:", round(total * 0.075, 2))
print("Total:", round(total * 1.075, 2))
Expected output for 500, abc, -20, 250, 1000:
Subtotal: 1750.0
VAT: 131.25
Total: 1881.25
Practical / learning evidence
ss3_receipt_bello.py accepts three positive prices and ignores text and negatives. The comment block records one valid, one text and one negative test with the observed line.
Resources and preparation
Python 3, IDLE, projector and printed test scripts. Offline route: hand-trace the code and write the three output lines.
Assessment for learning
Marks go to the condition, rejection branch and rounding. Watch for the counter incrementing early.
Inclusion and homework
Provide the print lines; extend others to a bulk discount. Homework: trace 100, 0, 200, text, 300.