How do `if`/`elif`/`else` pick exactly one branch to run — and why does indentation alone decide what belongs to each?
Short drills on what this video just taught. Write the code, run the checks, and reveal the answer only if you are stuck.
temp holds a temperature, given below. Using an if/else, assign the string
"hot" to label when the temperature is 30 or above, and "mild" otherwise
(>= is greater-than-or-equal). With temp = 28 the answer should be "mild".
The chain runs the first true branch
State that at most one block runs and that a missing else can leave none running, then contrast one chain against a row of separate if statements.
Indentation as block membership
Trace the hours-in-a-day chain for pset_time = 22 with sleep_time = 8, then 2, then a smaller sum, and record print("end of day") running every time.
Nested conditionals
Write the block where if y != 0 sits inside if x == y:, and give the output for equal values with nonzero y, equal values with zero y, and unequal values.
Ordering and indentation bugs
Record the unindented print("these are equal") firing on every input, and the guessing chain where a first test of guess >= secret reports too high for an equal guess.