+ 1
Why didn't the print statement got executed?
try: print(2/0) except: print('error') finally: raise TypeError print('last') This produced:error and TypeError. Why didn't the word 'last' got executed. Other e.g: try: print(2/0) except: print('error') finally: raise TypeError print('last') This also gave the same output.
4 odpowiedzi
+ 2
'raise TypeError' forces the TypeError exception which terminates the program as any other exception. So the last statement is never executed.
+ 1
in this case yes
+ 1
Sindhu Yes, it stops evaluating of the code
0
check out error handling