Post

100 Days Of Python - Day 13

Day 13

Debugging

  • Debugging is the process of finding and fixing errors in code.
  • The Python debugger is pdb.
  • pdb is a module that is built into Python.
  • It can be used to set breakpoints in code and step through the code line by line.
  • pdb can be used in the terminal or in PyCharm.
  • To use pdb in the terminal, use the python3 -m pdb command followed by the name of the file you want to debug.

Steps in debugging

  1. Reproduce the bug.
  2. Find the source of the bug.
  3. Fix the bug.
  4. Test the fix.
  5. Repeat steps 1-4 until the bug is fixed.
  6. Use print() statements to help you find the source of the bug.
This post is licensed under CC BY 4.0 by the author.