One useful idea
A decision rule is a contract, not a fact about media quality. Here the inputs are supplied width, codec and duration; the function does not inspect a clip. The classroom policy separates an invalid request from a completed pass/review/block verdict.
Validate types and ranges before comparisons. Width is a non-boolean integer from 1 to 16384; seconds is a finite non-boolean number greater than zero through 86400. Strip/casefold codec text, requiring 1–80 characters. An unsupported nonempty codec is a block reason, not a parsing error.
Accumulate reasons in codec, width, duration order. Unsupported codecs and widths below 1280 block; otherwise widths below 1920 or durations over 600 need review. Block dominates review, but every applicable reason remains. Exactly 1280 is review, exactly 1920 meets width, and exactly 600 meets duration. This policy is not a universal delivery standard.
Refresh first: Functions with validated inputs, Conditional order.
Trace a finished example
from qc_tools import delivery_risk
print(delivery_risk(1200, "gif", 601))
# block, with all three reasons; see the data belowThe result is {"verdict":"block","reasons":["unsupported codec","below 1280px","over 600s"]}. Returning at the first width review would hide later evidence. The complete function is in qc_tools.py.
The finished implementation is in qc_tools.py. Reading it is guided practice, not independent evidence.
Predict the boundary
What does 1280px, h264 and 600s require?
Compare your answer · self-reviewed
Review, with only below 1920px. Width 1280 is not below 1280.
Find the missing reason
Why not return as soon as a review rule fires?
Compare your answer · self-reviewed
A later codec/size block or duration reason could be lost. Collect evidence, then select the worst verdict.
Separate failure from verdict
Should width 0 produce block or an input error?
Compare your answer · self-reviewed
ValueError: zero is outside this contract. A valid decision and an unevaluated request are different states.
Try the idea in this browser
Runs in this browser · optional preparation · local project checks remain separate
Try a small function before opening your local files. Python downloads when you choose Run; if it cannot load, your code stays here and the local kit still works. The worker executes on your device, not on a DVP server. Only run code you trust: this is not a hostile-code security sandbox.
JavaScript loads the practice controls. Python starts only after Run.
The tutor button only prepares a question locally. Review it and choose Send yourself; no code is sent merely by running or opening a lesson.
Output
Errors and check feedback
Read the browser task briefs without running Python
Trace the declared policy
Read the complete function, predict a changed case, then Run. Write delivery_risk(width, codec, seconds). Width: non-bool int 1–16384. Codec: text, strip/casefold, 1–80 chars. Seconds: non-bool finite int/float, >0 through 86400. Unsupported codec (outside h264/hevc/prores) blocks; width <1280 blocks, otherwise <1920 needs review; duration >600 needs review. Return {verdict, reasons}. Keep every reason in codec/width/duration order: unsupported codec, below 1280px or below 1920px, over 600s. Block dominates review; no issues gives pass with [meets baseline]. Return the specified data for new inputs; wrong types raise TypeError and refused values raise ValueError. These classroom rules do not analyze media or establish objective quality.
Implement the policy independently
Write delivery_risk(width, codec, seconds). Width: non-bool int 1–16384. Codec: text, strip/casefold, 1–80 chars. Seconds: non-bool finite int/float, >0 through 86400. Unsupported codec (outside h264/hevc/prores) blocks; width <1280 blocks, otherwise <1920 needs review; duration >600 needs review. Return {verdict, reasons}. Keep every reason in codec/width/duration order: unsupported codec, below 1280px or below 1920px, over 600s. Block dominates review; no issues gives pass with [meets baseline]. Return the specified data for new inputs; wrong types raise TypeError and refused values raise ValueError. These classroom rules do not analyze media or establish objective quality.
Change it, then build your own
One controlled change
Run the reference at 1279, 1280, 1919 and 1920 pixels with h264/600s. Then add an unsupported codec and 601 seconds; predict all reasons first.
Your independent task
Write delivery_risk(width, codec, seconds). Width: non-bool int 1–16384. Codec: text, strip/casefold, 1–80 chars. Seconds: non-bool finite int/float, >0 through 86400. Unsupported codec (outside h264/hevc/prores) blocks; width <1280 blocks, otherwise <1920 needs review; duration >600 needs review. Return {verdict, reasons}. Keep every reason in codec/width/duration order: unsupported codec, below 1280px or below 1920px, over 600s. Block dominates review; no issues gives pass with [meets baseline]. Implement it in practice.py, not by importing the finished function. Return a new dictionary/list; do not print in this function.
What success looks like
Four risk test methods pass. Changed cases verify both exact boundaries, normalized codec text, multiple reasons, bad types and non-finite values.
Hint 1 · a question
Write each rule and its boundary before coding. Does a review justify skipping later rules?
Hint 2 · a concept cue
Collect reasons in codec/width/duration order, then choose block over review. Validate before classification.
Hint 3 · a localized example
An exact boundary such as width 1280 is review, not block. Try width 1200 with gif and 601 seconds to retain all three reasons.
Need the complete worked solution?
Open qc_tools.py from the kit. Trace it, close it, then try fresh inputs in your own files. Treat the attempt as guided; seeing the solution does not award a practical pass.
Course help is guidance, not independent evidence. With JavaScript, opening help records guidance locally; otherwise note it in your README. Reset does not erase that history.
Repair a failed check
If review masks block, separate collecting reasons from choosing severity. If True is treated as width 1, exclude bool before integer checks. NaN/infinity must be refused, not classified.
NotImplementedError means a practice stub is still unfinished. Read the failing test name and the last error line. Change one behavior, rerun that build, then rerun all implemented builds.
Show it works on new inputs
Build your own decision table with each boundary and a three-reason case. Explain one policy choice you would change for a different delivery contract; the explanation is self-reviewed.
Self-review: name the input, result, refused case and reason. Your local test output and explanation are separate from a quiz score; this page does not certify a pass.
Keep the idea
A verdict without reasons is hard to audit. Keep invalid-request errors, completed decisions and human interpretation separate.