Print vs pdb
print 和 pdb
Two semantic-error functions. Print debugging finds both. Brief intro to pdb for the day prints stop being enough.
Bug 1 — forgot to divide
Python · runnable
Bug 2 — boundary check
Python · runnable
The fixes
Python · runnable
When print stops being enough — try pdb
In a real script you'd add breakpoint() and run with python (not in browser)