Your task
Validate row count, unique IDs and known status values before analysis. Explain the expected output before running the code.
Hint
Read with csv.DictReader so column names are explicit. CSV values are strings until converted. Keep parsing failures visible.
Worked solution
The file contains eight unique orders. A failed assertion means stop and inspect the input; do not drop records to make the check pass.
import csv
with open('retail-orders.csv',newline='',encoding='utf-8') as f:
rows=list(csv.DictReader(f))
assert len(rows)==8
assert len({r['order_id'] for r in rows})==8
assert all(r['status'] in {'completed','cancelled'} for r in rows)Extend the test
Change one input in a disposable copy and predict which check should fail. Restore the original before comparing results.
Try the activity before reading its reference. Keep your sources, commands and assumptions with your work. Companion activities are unsaved self-practice and do not award a certificate or change lesson progress.