Categorise the following as syntax error, logical error or runtime [2]
error.
i) 27/0
(ii) x+y=25
(iii) x=y+2
(iv) x==5.. pls tell the correct answer my unit-1 exam
Answers
Answered by
1
Hello Mate! Here is the answer to your question.
(i) 27/0
When we print 27/0, the error obtained is known as ZeroDivisionError. We know that any number divided by 0 is infinite. According to Python, the denominator should be a non-zero number.
(ii) x+y=25
When we print x+y=25, we obtain syntax error. This error is obtained as expressions do not contain assignments.
(iii) x=y+2
When we print x=y+2, we obtain a name error as the variable 'y' is not defined; no value is specified for 'y'.
(iv) x==5
Here also, x variable is not defined and the error obtained is name error.
Similar questions