Paper Overview
The 2024 ICT Paper 1 continued the trend of heavier Python content, with over 55% of programming marks drawn from Python questions. Topics concentrated on lists, functions, and file handling.
Paper 1A — Key Python Questions
Q6: Tracing a nested loop
for i in range(3):
for j in range(i+1):
print("*", end="")
print()
Expected output: a right-triangle of stars. Many candidates misread range(i+1) as range(i) and produced an off-by-one error.
Q9: Counting characters
def count_vowels(s):
return sum(1 for ch in s.lower() if ch in "aeiou")
Paper 1B — Scenario
Students built a simple "school canteen" ordering system: a menu dictionary, a list of orders, and a totals function. Full marks required handling out-of-stock items and formatting the bill to two decimal places.
Sample solution
MENU = {"rice": 18.0, "noodles": 22.5, "soup": 15.0}
def total(orders):
return sum(MENU[item] * qty for item, qty in orders.items() if item in MENU)
Lessons Learned
- Format output exactly —
f"${x:.2f}"was worth 1 mark. - Handle edge cases — missing items, zero quantities.
- Use dictionaries for look-ups rather than long if/elif chains.
Practise this on PyForm — free
PyForm runs Python in your browser with an AI tutor trained for HKDSE. No install, no credit card.
Open PyForm →