04-02: Student Score Analyzer (NumPy)¶
Analyses a 10×5 array of student scores using NumPy 2D operations. Produces per-student averages/grades/ranks, per-subject statistics, min-max normalisation, and failure detection — all without Python loops.
Topics covered: np.mean(axis=0/1) · np.where · np.argsort · np.sum (boolean) · 2D boolean indexing · reshape · min-max normalisation · np.argmin/argmax
Difficulty: ⭐⭐⭐ Intermediate
Requirements¶
How to Run¶
Sample Report (truncated)¶
Name Math English Science History ICT Avg Grade Rank Fail
─────────────────────────────────────────────────────────────────────────
Riya 95 92 98 94 97 95.2 A+ 1 0
Nasrin 92 88 95 91 93 91.8 A+ 2 0
Salma 40 38 45 50 42 43.0 F 10 5 ⚠️
Key Concepts Practised¶
| Concept | Where used |
|---|---|
np.mean(scores, axis=1) |
Per-student averages |
np.mean(scores, axis=0) |
Per-subject means |
np.where(cond, true, false) |
Vectorised grade labels |
np.argsort()[::-1] |
Descending rank |
scores < 50 (boolean mask) |
Failure detection |
(x - min) / (max - min) * 100 |
Min-max normalisation |