Unit 04 · overview

Unit 4: Decisions in Code

A conditional is a policy written in code.

That is why tiny operators matter. Changing < to <=, moving one elif, or combining two conditions with the wrong boolean operator can change who gets accepted, rejected, classified, or charged.

Read the boundaries

This Unit works with if, elif, else, comparison operators, boolean expressions, and branch order. But the real skill is deciding what should happen at the exact edges of a rule.

If the requirement says:

18 and older -> ADULT
under 18      -> MINOR

then 18 is not just another test value. It is a boundary that proves whether the comparison matches the requirement.

You will build branch logic, predict which path executes, test values on both sides of a threshold, and investigate cases where individually reasonable branches produce the wrong result because their order is wrong.

Your branch table

Before leaving the Unit, create a compact table with at least four inputs, the branch you predict, the actual branch observed, and whether the result matches the written rule.

Include at least one exact boundary value and one deliberately broken version of the condition. The repair should be justified by the requirement, not by “changing operators until the output looked right.”