cs-129 — The Missing Marks

FieldValue
idcs-129
difficultyFoundational
topicsvalidation, missing values, communication
lecturelecture-12
estimated time5-minute attempt + 10-minute discussion
prerequisiteslecture-04 (state and sequences), lecture-09 (aggregation)
objectiveclassify incomplete records against an explicit rule before computing anything
solutionheld by the instructor; discussed after the attempt

Problem

The exams office exports this file, marks.csv, exactly as written:

name,mark
Ayla,72
Ben,
Cemre,abs
Deniz,64
Elif,999
Ferid,81

The office's written policy says: a blank or abs means the student was absent; a mark of 999 is a sentinel meaning recheck with the invigilator and is not a real mark. Your deliverable has three parts:

  1. Classify each of the six rows as include, absent, or recheck.
  2. Count each class.
  3. Compute the average of the included marks, to one decimal place — and state one thing that would go wrong if the 999 row were averaged in by a program that only checked "is it a number?".

If the problem is ambiguous anywhere, state the assumption you are making and carry on — a stated assumption is part of a good answer.

Examples

Solve for the worked instance first. Then ask what would change if one number, name, or condition were replaced by something stranger.

What to notice

Discussion starter

After the solution is revealed, the class spends five minutes on this prompt: "The office now sends a file where one mark is 72,0 — same row, two values. Where in your classification does this break, and what do you ask the office before touching the data?"

Constraints and assumptions

Hints and extension