Difference between runtime error and logical error
Answers
Answer- The above question is from the chapter 'Brief Overview of Python'.
Python-
Python is a simple programming language.
It has been created by Guido van Rossum and launched in 1991.
Its features make it easy to understand and this language is used a lot in the big companies and industries.
Given question: Differentiate between runtime error and logical error.
Answer: Differences between runtime error and logical error:
RUNTIME ERROR-
1) In this error, there is an abnormal termination of program while it is getting executed.
2) The syntax is correct in the program.
3) It may show- ''division by zero''.
EXAMPLE-
Runtime error occurs during division operation when we take denominator as 0.
(The screenshot has been attached.)
LOGICAL ERROR-
1) It is also called semantic error. It doesn't stop the execution of program.
2) It gives incorrect output.
3) It is tough to detect logical error as the output usually gets yielded but it is wrong.
EXAMPLE-
During the finding of average, one may make mistake in the code. It results in undesirable output.
(The screenshot has been attached.)