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)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

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

Okay