Code Reading · interview question
Which option is the safer default when shipping code around dry runs and rule narration?
Multiple choiceHardchapter-2-curatedpremiumcode-readingdry-runs-and-rule-narration
def preview_shipping(subtotal: float) -> str:
if subtotal >= 100:
return "free shipping"
return "standard shipping"Answer and explanation
Correct answer
A. Choose the simpler shape that keeps the rule obvious, validated, and easy to observe in logs or tests.
Why
The safest default is usually the one that lowers ambiguity and makes errors easier to diagnose.
Test yourself on Code Reading
A free test with instant, explained results. No account needed.
More Code Reading questions
- Which judgment is strongest when choosing a data shape for first mini project?
- Which boundary choice best fits first mini project in a maintainable Python system?
- When is first mini project being used in the wrong way?
- Which explanation would best help the team align on first mini project?
- Which option treats first mini project as an engineering policy decision instead of a syntax trick?
- Which option treats dry runs and rule narration as an engineering policy decision instead of a syntax trick?