code-playpad

Loops

A separate page with a real URL. Arrive here through the nav links and the document is never torn down, so the worker (and a warm Pyodide) comes with you — watch document alive in the strip above keep counting. Reload the page and it resets to zero.

for

for i in range(5): print(i, "squared is", i * i)

while

n = 27 steps = 0 while n != 1: n = n // 2 if n % 2 == 0 else 3 * n + 1 steps += 1 print("collatz steps:", steps)
Edits are saved to IndexedDB under the persist id, so they survive navigation and a full reload. Completed: