हिंदी

“Every syntax error is an exception but every exception cannot be a syntax error.” Justify the statement. - Computer Science (Python)

Advertisements
Advertisements

प्रश्न

“Every syntax error is an exception but every exception cannot be a syntax error.” Justify the statement.

संक्षेप में उत्तर

उत्तर

Exception is an error which occurs at Run Time, due to Syntax Errors, Run Time Errors or Logical Errors. In Python Exceptions are triggered automatically. It can be called forcefully also by using the code.

Syntax Error means errors occurs at compile time, due to not followed the rules of Python Programming Language. These errors are also known as parsing errors. On encountering a syntax error, the interpreter does not execute the program unless we rectify the errors, save and rerun the program. When a syntax error is encountered while working in shell mode, Python displays the name of the error and a small description about the error.

Because Exception can be occurred due to Syntax Errors, Logical Error and Run Time Errors, while Syntax errors occurs only due to syntax. So that “Every syntax error is an exception but every exception cannot be a syntax error.”

shaalaa.com
Syntax Errors
  क्या इस प्रश्न या उत्तर में कोई त्रुटि है?
अध्याय 1: Exception Handling in Python - Exercise [पृष्ठ १७]

APPEARS IN

एनसीईआरटी Computer Science [English] Class 12
अध्याय 1 Exception Handling in Python
Exercise | Q 1. | पृष्ठ १७
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×