How to debug Python scripts and API code in the console and in VS Code

How to debug Python scripts and API code in the console and in VS Code