Problem Solving and Python Programming: UNIT II: Data Types, Expressions, Statements

Debugging

Python Programming

Programming errors are called bugs and the process of tracking them down and correcting them is called debugging.

Debugging

Concept of debugging:

• Programming errors are called bugs and the process of tracking them down and correcting them is called debugging.

• There are three types of errors that occur in the program,

1. Syntax errors

2. Runtime errors

3. Semantic errors

1. Syntax Errors

• Syntax means structure of the program and rules about that structure. For example - in ‘C every assignment statement must be terminated by a semicolon'. If this rule is not followed by the programmer then the syntax error occurs in the program.

Python can not execute the program if it is syntactically incorrect.

• With sufficient practice of programming, the finding and removing syntactical errors become easy.

2. Runtime Errors

• The runtime errors are the errors that occur due to bugs in the logic implementation of your program. Removing the runtime errors is complex and it requires sufficient programming skills.

• These errors are also called as exception.

3. Semantic Errors

• If there is a semantic error in your program, it will run successfully, in the sense that the computer will not generate any error messages, but it will not do the right thing.

• Semantic errors occur when the meaning of program differs from its purpose.

• Identifying semantic errors can be tricky because it requires to analyse the output of the program and try to figure out what it is doing.

 

Problem Solving and Python Programming: UNIT II: Data Types, Expressions, Statements : Tag: Engineering Python : Python Programming - Debugging