Best afterAdding up a list·A comparison is a yes/no value

Running maximum

Tracking the biggest value seen so far is the accumulator pattern with a twist: what do you start it at? Seed it wrong and a whole class of inputs gives the wrong answer.

Track the largest number seen so far as you walk the list.

Running maximum — seeded at zero execution-derived · CPython
5        max_so_far = n
same data, two zoom levels
state after line 1 runs
-5-2-8-1
step 1 / 11

Click a line, drag the slider, or use the keys.

What you are looking at

Watch max_so_far as each n goes by.

This is a milestone — it puts several earlier ideas together into one small program.

Every state you see came from running the program under CPython's tracer at build time — see how GlassBox stays honest.