What Grade 5** Students Do Differently

Grade 5** in HKDSE ICT is achieved by roughly 1-2% of candidates. The gap between Grade 5 and Grade 5** isn't about knowing more โ€” it's about executing cleaner.

Technique 1: Write Idiomatic Python

Examiners recognise "beginner code" vs "Python-native code". Compare:

# Beginner style
count = 0
for x in scores:
    if x >= 50:
        count = count + 1

# Grade 5** style
count = sum(1 for x in scores if x >= 50)
# or
count = len([x for x in scores if x >= 50])

Technique 2: Use Built-In Functions First

Technique 3: Early Returns

# Beginner
def is_pass(score):
    if score >= 50:
        return True
    else:
        return False

# Grade 5**
def is_pass(score):
    return score >= 50

Technique 4: Use Dictionary Counting

# Count occurrences elegantly
from collections import Counter  # NOT for HKDSE

# HKDSE-safe version:
counts = {}
for item in data:
    counts[item] = counts.get(item, 0) + 1

Technique 5: Sort with key Parameter

students = [("Chan", 85), ("Lee", 72), ("Wong", 91)]

# Sort by score descending
students.sort(key=lambda x: x[1], reverse=True)
# [("Wong",91),("Chan",85),("Lee",72)]

Technique 6: Handle Edge Cases

Top students always check for:

Technique 7: Clean Output Formatting

# Messy
print("Name:",name,"Score:",score,"Grade:",grade)

# Clean
print(f"Name: {name}  Score: {score}  Grade: {grade}")

# Professional
print(f"{'Name':<10}{'Score':>6}{'Grade':>6}")
print(f"{name:<10}{score:>6}{grade:>6}")

Technique 8: Comment Strategically

Don't over-comment obvious code. Do explain why for non-obvious choices:

# Bad: comments what code says
count += 1  # increase count by 1

# Good: comments why
# Skip header row
next(reader)

Technique 9: Reuse via Functions

If you write the same logic twice, extract a function. Examiners notice code organisation.

Technique 10: Manage Your Exam Time

Level Up in PyForm

Practise with FORM AI's Socratic feedback to refine your code into Grade 5** quality.

Start Practising โ†’