launch.json: the one-time setup

The Run & Debug view (ctrl+shift+d) needs to know how to actually start your program — that's what .vscode/launch.json records, once per project. VS Code offers to generate one automatically the first time you click "Run and Debug" with a supported language open.

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Python: Current File",
      "type": "debugpy",
      "request": "launch",
      "program": "${file}",
      "console": "integratedTerminal"
    }
  ]
}
            
f5 | https://code.visualstudio.com/docs/editor/debugging | starts debugging with the currently selected launch configuration |'vsd_launch1'

breakpoints

click in the gutter next to a line number | | sets a regular breakpoint — execution pauses here every time |'vsd_bp1'
Right-click an existing breakpoint (the red dot) for two more useful variants:
VariantBehavior
Conditional breakpointonly pauses when an expression you supply evaluates true, e.g. i == 42
Logpointdoesn't pause at all — prints a message to the Debug Console instead, without editing the source to add a print statement

while paused

f10 | | step over — run the current line, don't descend into any function it calls |'vsd_step1'
f11 | | step into — descend into the function call on the current line |'vsd_step2'
shift+f11 | | step out — finish the current function and pause back in its caller |'vsd_step3'
f5 | | continue — run until the next breakpoint (or the program ends) |'vsd_step4'

watch expressions and the debug console

The Variables panel shows everything in scope automatically. The Watch panel is for anything you want pinned and visible continuously — type any expression in, including ones that aren't simple variable names (e.g. len(results)).
The Debug Console is a live REPL in the paused program's exact context — type any expression and it evaluates immediately, using the real values currently on the stack. This is usually faster than adding a print statement and restarting the whole run.

related topics

Debugging: gdb, pdb & a General Method — the same concepts (breakpoints, stepping, watches) from the command line instead of a GUI.
VS Code Cheat Sheet — the interface this debugger lives inside.
Python Notes & Cheat Sheet — the language most of this page's examples assume.

reference

code.visualstudio.com — debugging
code.visualstudio.com — Python debugging