The fast lane

Unit 3 — Classes and contracts

Outcome: turn a prose requirement into a typed input/output boundary with explicit failure behavior.

Learners create a small data structure, validate its fields, and write tests for a valid case and at least two invalid cases. The focus is not class syntax; it is making assumptions executable before a model or tool can violate them.

Learning contract

The implementation must reject malformed data at the boundary, preserve a stable serialized shape, and raise an error that names the violated contract. Silent coercion is treated as a failure.

Artifact

Submit the executed notebook, typed contract, and tests. Include one sentence explaining which downstream failure the validation prevents.

Previous: Packages and documentation · Next: Calling a real API