How will you debug a piece of code in Python?

In Python, we can use the debugger pdb for debugging the code. To start debugging we have to enter following lines on the top of a Python script.

import pdb


After adding these lines, our code runs in debug mode. Now we can use commands like breakpoint, step through, step into etc for debugging.