Debugging
Beyond adding print() statements everywhere, Python's built-in
debugger (pdb) lets you pause execution and inspect variables at an
exact line.
def calculate_total(prices):
breakpoint() # execution pauses here
return sum(prices)
Running the program then drops into an interactive prompt at that line,
where you can type variable names to inspect their current values, or
n to step to the next line. Most editors (including VS Code) also offer
a visual debugger with clickable breakpoints, built on the same idea.