Logic, loops and functions
A condition encodes a scientific decision; a loop applies it to each sample; a function packages the rule for testing and reuse.
Loading video…
A condition encodes a scientific decision; a loop applies it to each sample; a function packages the rule for testing and reuse. Parameters are inputs and return values are outputs that later analysis can use. Keep thresholds named and document why they were chosen. Printing a result is not the same as returning it.
Worked example
Define is_high(value, cutoff): return value > cutoff. Applying it to [4, 9, 6] with cutoff 7 returns [False, True, False], which can be checked against known samples.