DEV Community

pagarsach14
pagarsach14

Posted on

1

Exceptions versus Syntax Errorspython

Exceptions versus Syntax Errors
Syntax errors occur when the parser detects an incorrect statement. Observe the following example:

print( 0 / 0 ))
File "", line 1
print( 0 / 0 ))
^
SyntaxError: invalid syntax
The arrow indicates where the parser ran into the syntax error. In this example, there was one bracket too many. Remove it and run your code again:

print( 0 / 0)
Traceback (most recent call last):
File "", line 1, in
ZeroDivisionError: integer division or modulo by zero
summary this code some cases mostly use if you have need more detailed information then visit https://www.pythonslearning.com


Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay