Debugging – finding and fixing the bugs (errors) in a program
- error types:
- syntax – rules of the program and Python expression structure; a program will not run if there is a syntax error
- runtime – errors that occur during the running of the program; the process will stop when an exception is raised (a runtime error has occured); runtime errors are synonymous with exceptions (division by zero is an example of a runtime error)
- semantic – the execution process is complete, but the result is incorrect (coding 3.1415+r**2 instead of 3.1415*r**2 for the area of a circle formula is an example)
- finding & fixing:
- syntax errors are almost instantaneously evident during the program composition phase and the fix can be done ‘on the spot’
- exceptions are raised during the execution of the program along with some explanation and a reference to the location
- semantic errors often require experimental processes and/or ‘working backwards’ in the code to find the cause(s) of an incorrect result