+ 1
Catching Exception
https://code.sololearn.com/ce6m8vXTUZxU/?ref=app why exception block is not executing
4 ответов
+ 5
print ("hello") instead of print "hello"
+ 5
An error occured in the try part, so it switches to the except part instead of crashing the program. Hope it helps!
num = 5
try:
num = num/0
print ("hello")
except:
print("hello world")
+ 1
SyntaxError is not a runtime error, but a compile time error, thus it cannot be caught in the code that has not been compiled.
0
that's exception I want to catch and print proper output in except block