edSlash Interactive Python Lab

Python Visualizer

Explore how Python executes. Visualise variables, data structures, functions, loops, nested loops, object references, memory and program flow through an interactive execution environment.

Python runtime not loaded The Python engine loads when you run your first program. Powered by Pyodide / CPython
Python Code Editor Write your Python program
Real Python execution · Supports indentation, functions, classes, collections, nested loops and standard Python syntax.
Execution Trace Python line-by-line history
Waiting for execution Line —
Run your code to generate an execution trace.
Step 0 / 0
Program Flowchart / Source Map Current statement highlighted
Run a program to generate its source map.
Stack Memory Active function frames
Function frames will appear here.
Stack: active function frames and local variables
Heap Memory Objects and references
Data structures and objects will appear here.
Heap: simplified object-reference view Ref: object identity
Loop Counter Monitor Loop-header visits
Loop activity will appear here.
Console Output Standard output
Program output will appear here...
Execution Explanation Learning assistant
Select an example and run it. The explanation will update as you navigate through the execution history.
Important Learning Notes
  • The Python engine runs in your browser using Pyodide. The first load requires an internet connection.
  • The stack and heap panels are simplified teaching visualisations of Python frames, local variables and object references. They are not a literal map of CPython's physical memory.
  • Execution history records Python line events. Multiple operations on one line may appear as a single trace event.
  • The flowchart is a source-line map with the current line highlighted. It does not yet represent every conditional branch or loop-back edge.
  • The loop monitor counts visits to loop-header lines. For a while loop, this can include the final condition check that ends the loop.
  • Do not run untrusted code. This is a browser-based learning environment, not a secure server-side code sandbox.