Lecture Note
University
American Baptist CollegeCourse
CSCI 1534 | Data Analysis and VisualizationPages
2
Academic year
2023
Muthia Marhamah
Views
0
Troubleshooting : Error Class Syntax Error Python will find these kinds of errors when it tries to parse your program and exit with an error message without running anything. Syntax errors are detected while the program Is being compiled, once any error is found, it will prevent the code from executing. Some most common causes of syntax error: Misspelled reserved keywords Missing required spaces Missing quotes Misuse of block statement (if-else, loops) Missing assignment operator Invalid variable declaration Invalid function calling For example: Logic Error Logic Errors are the most difficult to fix. They occur when the program runs without crashing but produces and incorrect results. The error is caused by a mistakes in the program logic. Here are some examples of mistakes which lead to logical errors: Using the wrong variable name Indenting a block to the wrong level Using integer division instead of floating-point division Getting operator precedence wrong Making a mistakes in a Boolean expression Off-by0ne, and other numerical errors For example:
When we run this code, we will get error like this.
Troubleshooting (Logic Errors and Syntax Errors)
Please or to post comments