1. Pyroom
  2. Tutorials
  3. Debugging
  4. Set a breakpoint and step through Python code

Set a breakpoint and step through Python code

The debugger pauses on a line you choose and shows every variable, so you can see what a loop really does.

Beginner Video coming soon. The steps below show everything the video will cover.

Steps

  1. Here is a loop that adds up some numbers.
  2. Turn on the debugger with the bug button in the toolbar.
  3. Click line number three to set a breakpoint, then press Run.
  4. The program pauses. Step Over runs one operation at a time; watch total in the Variables panel.
  5. Continue runs to the next breakpoint. Inside a loop that is the same line again, so press it until the program finishes and prints 12.
Read the transcript

Here is a loop that adds up some numbers.

Turn on the debugger with the bug button in the toolbar.

Click line number three to set a breakpoint, then press Run.

The program pauses. Step Over runs one operation at a time; watch total in the Variables panel.

Continue runs to the next breakpoint. Inside a loop that is the same line again, so press it until the program finishes and prints 12.

Try it in the Playground

Nothing to install and no account needed.

Open Playground →