Problem Statement - B01A
Differentiate between Syntax Error and Run-Time Error? Also, write a suitable example in Python to illustrate both.
Solution
CSKC| Created: 9-Jan-2019 | Updated: 9-Jan-2019|CBSE12A-2018
Differentiate between Syntax Error and Run-Time Error? Also, write a suitable example in Python to illustrate both.
|
Syntax error : An error of language resulting from code that does not conform to
the syntax of the programming language.
Example
a = 0 while a < 10 # : is missing as per syntax a = a + 1 print a
Runtime error : A runtime error is an error that causes abnormal termination of
program during running time..
Example
A=10 B= int(raw_input("Value:")) print A/B # If B entered by user is 0, it will be run-time error
CSKC| Created: 9-Jan-2019 | Updated: 9-Jan-2019|CBSE12A-2018