exception | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

exception

which error will be occured during the execution of this code : try: print(1 / 0) except ZeroDivisionError: raise ValueError Here they said : 'ZeroDivisionError and ValueError But when i tried it the error that occured is ; "Syntaxe Error"

14th Nov 2020, 8:56 PM
oualid hajane
oualid hajane - avatar
4 Answers
+ 2
It works just fine. Try double checking your spellings and indentations.
14th Nov 2020, 9:21 PM
Tomiwa Joseph
Tomiwa Joseph - avatar
+ 1
Am getting ZeroDivisionError and ValueError as expected. Check again.. Tag the language also.. As python.
14th Nov 2020, 10:08 PM
Jayakrishna 🇮🇳
0
oualid hajane I think if you are writing the same code you posted here you definitely will get a synthax error, try to see onpine a template for the try and catch
14th Nov 2020, 9:43 PM
Khaled ^^ خالد القريشي‎
Khaled ^^ خالد القريشي‎ - avatar
0
Hey oualid hajane I assume you are using java and here is a template. try { // Block of code to try } catch(Exception e) { // Block of code to handle errors }
14th Nov 2020, 9:45 PM
Khaled ^^ خالد القريشي‎
Khaled ^^ خالد القريشي‎ - avatar