Skip to main content

Python Tutor


Python tutor (http://pythontutor.com/) is free educational tool created by Philip Guo for teaching python programming. It enables you to visualise the execution of python code.

On the left pane is the python code. Arrows indicate which line is executed.

On the right pane we have two parts, the frame pane and the object pane.

  • The frame pane contains variable and function names (eg placeholders for objects)
  • The object pane contains values
  • Arrows point from variable names to values

Numbers are usually written directly next to variables or within lists to avoid having too many arrows within the right pane.

The ‘global frame’, in the frame pane, contains all the global names for variables and functions (eg those defined in the main program, not within functions).

Additional frames named after each function defined appear under the ‘global frame’ and contain the variables defined locally within each function (including input arguments). This helps distinguish variables local to a function from variables defined globally.

You can modify the examples given by clicking on ‘edit the code’ below the code window.