Applied Checkpoint: Clean a Course Record
Unit ID: M02-U08 Estimated active time: 35-50 minutes
Your task
Clean and summarise this fictional course record:
raw_course_name = " PYTHON foundations FOR ai "
raw_course_code = " py-ai-02 "
raw_planned_hours = " 32 "
raw_status = " PLANNED "
instructor_name = None
Do not replace the raw values. Create new, clearly named clean values so the original evidence remains visible.
Required transformations
- Remove outside whitespace from every text input.
- Create a display course name in title case, then correct
AitoAI. - Create an uppercase course code.
- Convert planned hours to an integer.
- Create a lowercase status.
- Create a boolean named
is_availableby comparing the clean status with"available". - Confirm explicitly whether
instructor_nameisNone. - Extract the first two characters and final two characters from the clean course code.
Required summary
Use f-strings to print labelled lines containing:
- course name;
- course code;
- planned hours;
- status;
- availability boolean;
- whether an instructor name is missing;
- the two-character code prefix; and
- the two-character code suffix.
Predict before running
Write down:
- the clean course code;
- the integer planned hours;
- whether
is_availablewill beTrueorFalse; and - the code prefix and suffix.
Then run the program and compare.
Required inspection
Print the types of:
- the raw planned-hours value;
- the clean integer planned-hours value;
- the availability value; and
- the instructor value.
Explain why each type is suitable or what future validation may still be needed.
Clean-rerun test
Restart the kernel and run all cells from top to bottom. Confirm that no clean value depends on hidden state and that the raw values remain unchanged.
Self-review rubric
| Criterion | Not yet | Meets |
|---|---|---|
| Raw evidence | Raw values are overwritten | Raw and cleaned values remain separate |
| Text cleaning | Whitespace or required case remains incorrect | Name, code, and status follow the stated rules |
| Conversion | Planned hours remains text or is converted without explanation | Planned hours is an integer created from suitable cleaned text |
| Boolean and absence | Availability or missing instructor is guessed | Both are created with explicit comparisons |
| Slicing | Prefix or suffix is incorrect | Both two-character slices are correct |
| Output | Results are unlabelled or joined unsafely | F-strings provide clear labelled output |
| Types | Required type inspection is absent | All four required types are inspected and explained |
| Reproducibility | Clean rerun fails or changes raw evidence | Restart-and-run-all succeeds with raw values preserved |
Complete the checkpoint only when every criterion meets the standard.
