Workspace/Coding labs
Loading progress

Detect evidence dependence and conflict

Intermediate50 min

Implement evidence_matrix(records, claims). Records contain claim, origin, and stance (support or oppose). For each requested claim, return sorted unique support and oppose origins and a state: contested if both sets are nonempty; corroborated if at least two support origins and no opposition; single_origin for exactly one support origin; opposed for opposition only; unsupported for neither. Ignore unrequested claims. Input records are already relevant and temporally eligible. This is an evidence bookkeeping algorithm, not automated fact verification.

Your task

  1. Complete the starter function using the contract above.
  2. Use the examples and visible tests to check normal inputs, boundaries, and rejected inputs.
  3. Run tests to record your result, then compare with the explained reference solution.

Examples

EXAMPLE 1

InputTwo copies from origin a support q

Outputsingle_origin

Copies share an origin.
EXAMPLE 2

InputOrigin a supports q and origin b opposes q

Outputcontested

Conflicting evidence is retained.
solution.pyPython 3.12