Handling Debugging in Python
This week has left me feeling much more confident in my ability to code. We learned about common error messages and how to handle them through a process called debugging. We were given three pre-made scripts and were tasked with finding and debugging the errors.
The first script included simple syntax errors, which are errors in the convention of the coding language. These commonly include misspellings, incorrect upper or lowercase usage, missing punctuation, or incorrect indentation. Below is a screenshot of the script output after correcting for syntax.
Exception errors can be "trapped" with try-except statements. As seen in the flowchart below, we can write the code in such as way to go around the exception.
We can even have the exception error message printed along with the rest of the desired results.
Comments
Post a Comment