Programming Chunks

Explore Python And Data Science with me!!

Home ยป Tips for efficient code debugging in python

Tips for efficient code debugging in python

code debugging in python

Wonder why code debugging? So, you have the python code ready and you are not able to find out what is wrong. Why you are not getting the output?

I know you have python debugger that you can use and that’s a different story. But with Vs code, it’s easy.

Open the debugger icon, and run the debugger. You will be asked what python debugger you can use. Choose the first option and you have set the debugger.

Now, you will have to click on the code at the side to set the breaking points, a red color dot will appear, and at that point, the debugger will stop and show the result.

Usually, I set breakpoints on the loop and track variables and lists or dictionaries.

Don’t forget the is and arr[i] s to track in loops

Additionally, you can set variables in the watch sections to track by clicking the add button.

That way you can check the value of the variable as you click on the play button in a small popup that appears. You can use the continue and step over buttons to do a step-by-step traversal of the code.

Hope that helped! Let me know of any queries

pallavy.com

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top