A breakpoint can have a condition, so the program stops only when it is true, and the debugger panel follows any expression you type, not only the variables.

scores = [12, 45, 7, 88, 23, 91, 34, 56, 3, 77]
total = 0
best = scores[0]
for i in range(len(scores)):
    total += scores[i]
    if scores[i] > best:
        best = scores[i]
print("Total:", total)
print("Best:", best)

Student
  1. Right-click (or Shift+click) left of line 5 and enter the condition i == 6: the breakpoint gets an amber ring. Run stops only in the seventh pass of the loop.
  2. In the panel Watch type scores[i] and click Add, then add total / (i + 1), the average so far.
  3. Click Step a few times: a value that changed is marked. Drag the slider of the timeline back and the expressions show their earlier values.
Teacher
  1. Works for Python in the browser and for C and C++ on the CodeLab runner 0.20 or newer; nothing to set in the example.
  2. A condition saves clicking Step fifty times: stop right at the pass where the output goes wrong.