Practice and Reference Answers
This exercise is an authored scenario. You can complete it without Python, Git, or an AI account. The candidate code and observed outputs below provide the evidence you need. Optional runnable files are included in the portable package.
Your assignment as reviewer
Use the same reading-list contract: trim edges, omit blanks, compare duplicates with casefold(), preserve the first trimmed spelling and original order, return a new list, and leave the input untouched. Supported inputs are lists of strings. No packages, file writes, network access, or interface changes are authorized.
The worker is asked to correct the rejected candidate. It submits this patch, provided in full in the downloads:
- return sorted({title.strip().lower() for title in titles if title.strip()})
+ result = []
+ seen = set()
+ for title in titles:
+ cleaned = title.strip()
+ if not cleaned:
+ continue
+ key = cleaned.lower()
+ if key not in seen:
+ seen.add(key)
+ result.append(cleaned)
+ return result
The simulated handoff says: "Corrected order and first spelling. All three smoke tests passed. I recommend acceptance." The smoke cases are empty input, whitespace trimming, and an ordinary mixed-case duplicate. The worker gives no evidence for the Unicode comparison rule.
Supplied observations
The smoke runner exits with status zero. A fuller run against the supplied eleven-case contract suite exits with status one: ten tests pass and the Unicode case-folding test fails. These results are produced by running the exercise candidate; the report above is a simulated worker claim.
input_titles = ["Straße", "STRASSE"]
expected = ["Straße"]
observed_exercise = ["Straße", "STRASSE"]
For a second check, ["Solaris", "Dune", "solaris"] produces ["Solaris", "Dune"], and the input list remains unchanged. The candidate has no imports and no file or network calls. Those observations support some requirements while leaving the failed comparison rule unresolved.
Write your review
- Decide whether to accept or request revision under the existing contract. Explain the deciding requirement.
- Identify what the smoke-test evidence establishes and what it does not establish.
- Name the smallest correction and the checks you would require afterward.
- Write a bounded correction request in three or four sentences.
- State who decides product acceptance and who may commit or publish.
- List the materials you would keep so someone else can reproduce the decision offline.
Take a moment to answer before opening the reference section. You are practicing a decision from evidence, not guessing which wording a quiz expects. Equivalent sound reasoning is welcome.
Show reference answers
Reference answers
Decision: request revision. The agreed duplicate comparison is casefold(). The candidate uses lower(), which does not merge the supplied Straße and STRASSE case. A successful smoke run cannot override a failed explicit acceptance criterion. The candidate is a useful improvement, but is not yet complete under this assignment.
Evidence limits: the three smoke tests demonstrate the stated results for those cases and this candidate. They support trimming and ordinary duplicates, but do not cover the declared Unicode comparison. The fuller run identifies the actual missing behavior. The absence of imports and the inspected function body also support the bounded scope; they do not certify the safety of a larger application.
Smallest correction: change cleaned.lower() to cleaned.casefold(). Keep the stored output as cleaned so the first spelling is preserved. Rerun the eleven-case suite against the corrected file, check the input-preservation case, and inspect the diff for unrelated changes. A larger rewrite or a new dependency is unnecessary for this requirement.
Possible correction request: "Revise the duplicate comparison to use the agreed casefold rule. The supplied Unicode case currently returns two titles where one is expected. Keep the existing interface, first spelling, original order, and scope exclusions; rerun the complete contract suite and provide the exact result plus the diff. Do not commit or publish."
Authority: the owner evaluates the desired experience and accepts the product. A reviewer supplies technical findings; a worker supplies a candidate and evidence. Under this example's permissions, the worker may not commit or publish. In another project, those permissions could be different, but they must be explicit rather than inferred from tool access.
Recovery materials: keep the assignment, baseline source, exercise and corrected candidates, tests, exact commands and results, readable diff, limitation note, and the owner's eventual decision. Include Python requirements and a README so another person can run it without the chat. Connect the decision to a specific source version or integrity manifest.
Optional local practice
After extracting the portable ZIP, open a terminal in its root. These commands execute only the included local example tests:
python3 example/run_checks.py exercise --smoke
python3 example/run_checks.py exercise
python3 example/run_checks.py corrected
Expect exit statuses zero, one, and zero respectively. The exercise failure is intentional. Compare your review with the actual output before editing anything. If you want to practice a correction, copy the example into a separate directory first; keep the supplied evidence intact for comparison.
Apply the method to your work
Return to the owner's note you wrote in Lesson 1. Fill in the assignment template for that change. Identify one plausible wrong result and a case that distinguishes it from success. Write an acceptance note that clearly separates checks you performed from checks you merely want someone to perform.
Finally, imagine handing the result to a new maintainer. Supply the source, decisions, run instructions, verification evidence, and recovery card they would need. You have completed the exercise when you can explain both your decision and how another person could check it. There is no certificate or enrollment record; keep the useful materials and adapt the method.
