Errors: syntax errors, logical errors, runtime errors
Errors :
Errors are the problems or the faults that occur in the program, which makes the behavior of the program abnormal, and experienced developers can also make these faults. Programming errors are also known as the bugs or faults, and the process of removing these bugs is known as debugging.
Debugging:
Debugging is the process of detecting and removing of existing and potential errors (also called as ‘bugs’) in a software code that can cause it to behave unexpectedly or crash.
To prevent incorrect operation of a software or system, debugging is used to find and resolve bugs or defects.
Syntax Error:
Grammar mistake done by programmer.
Syntax Errors occur when we violate the rules of writing the statements of the programming language.
Syntax Errors are caught by the compiler.
Syntax error usually appear at compile time and are reported by the interpreter
Example
Not ending an if statement with the colon
Misspelling a Python keyword (e.g. using whille instead of while).
whille x%2 == 0:
Logical errors
Logical Errors occur due to our mistakes in programming logic.
also called semantic errors, logical errors cause the program to behave incorrectly, but they do not usually crash the program.
Unlike a program with syntax errors, a program with logic errors can be run but produce incorrect output.
x = float(input('Enter a number: '))
y = float(input('Enter a number: '))
z = x+y/2
print ('The average of the two numbers you have entered is:',z)
Runtime Errors:
A runtime error in a program is an error that occurs while the program is running after being successfully compiled.
Runtime errors are commonly called referred to as “bugs” and are often found during the debugging process before the software is released.
Division by Zero.
Modulo Operation by Zero.
What do you mean by lvalue and rvalue in python?
lvalue : object that come on the left hand side of an assignment.
rvalue : expression that come on the right hand side of an assignment. In python everything is rvalue
a=20
b=30
c=a+b
But you cannot write as
a+b=c
20=a