Learn Before
Concept
General Tips for Debugging
- Look for the line number in the error message to find where the interpreter believes the error is coming from. Trace backwards if error doesn't stem from that line
- Understand the different types of errors (Syntax, Runtime, Semantic)
- Use print statements to check the values of variables and if a block of code is being run, especially when your code has if-statements or loops
- Debug code in blocks as you go. This will make it easier to find more subtle semantic issues instead of having to look through your entire program when debugging at the end -Usage of Break Points can be very useful if your IDE allows for it. This way you can run the program up to the break point and step through the code step by step checking the value of variables and comparing it to what you expect it to be. If there is a miss-match then you can trace it back to the line where the program deviated from your intended functionality.
-When dealing with large amounts of data, use mocking to test your code as you build bigger projects. Mocking is the action of running smaller, more palpable data sets through code to more easily see errors in code designed for larger amounts of data.
0
2
Updated 2021-06-15
Contributors are:
Who are from:
Tags
Data Science