There will be times where you will run into an error of some sort. Compilation errors are usually easy to diagnose but runtime errors and logical errors are much more difficult to find and fix. The Python Visualizer is a useful tool that takes your code, analyzes it and visualizes the execution as a step-by-step process.
Begin by copying and pasting your code into the editor. Here, I am using the insertion sort algorithm example code provided by the website.
Next, you’ll be brought to a screen with the following parts:
- On the left is your code. There are two arrows for indicating where your program is currently at and what the next line executed will be. This helps you follow how your program is being run.
- Below it are the steps. You may either go to the beginning of the program, the previous step, the next step or the final step.
- On the right contains your frames and objects. This is where you will see all of your program’s variables and data and how they look like right now. As you proceed with each step, you can see how they change.
With all this information, you can hopefully pinpoint where your problem is located. The next time you run into an error or if your program doesn’t seem to be doing what it is supposed to do, consider using the Python Visualizer.