Python programs operate on objects with explicit input, ownership and failure contracts.
Learning roadmap
This section contains 17 written lessons or quiz banks. Programs are verified on CPython 3.14.6. Standard-library lessons target 3.11+ syntax; lessons using data, web, machine-learning or testing packages state their tested dependencies separately. Framework programs use local test clients, not a deployed service. Read the stated limits before adapting a fixture into an application.
Validate before publication
Read the contract, run its program and inspect the failure case.
- Python collection exercise: reject repeated receipt IDs before committing state
- Python input exercise: accept an explicit integer grammar
Failure before state replacement
Read the contract, run its program and inspect the failure case.
Independent window, interval and record answers
Read the contract, run its program and inspect the failure case.
- Python window exercise: verify a fixed-width maximum against direct slices
- Python range exercise: immutable prefix totals and exclusive endpoints
- Python aggregation exercise: validate records before returning group totals
Identity-aware reconciliation
Read the contract, run its program and inspect the failure case.
Clock and identity boundary exercises
Read the contract, run its program and inspect the failure case.
Feasibility before optimality
Read the contract, run its program and inspect the failure case.
Multiplicity and half-open ranges
Read the contract, run its program and inspect the failure case.
- Python exercise: reconcile duplicate receipt counts without losing multiplicity
- Python exercise: validate half-open reservations before accepting a batch
- Python exercise: retain first-seen order while rejecting duplicate IDs
Merge, runs and dependency checks
Read the contract, run its program and inspect the failure case.
- Python exercise: merge two sorted feeds and preserve left-first ties
- Python exercise: encode consecutive states without merging distant runs
- Python exercise: verify a dependency order without confusing it with reachability
Stable ranking and half-open ranges
Read the contract, run its program and inspect the failure case.
- Python exercise: select the highest scores with stable tie order
- Python exercise: merge overlapping half-open reservations
Continue learning
Move between tutorial, collections, advanced material and practice using the subject tabs. The sidebar changes with each section; related examples keep one canonical lesson URL.
