0

Why this code didn't run try and finally statement

https://code.sololearn.com/cXPx32yLKkkv/?ref=app

18th Nov 2019, 11:11 PM
Ansab Khan
Ansab Khan - avatar
5 Réponses
+ 1
Ansab Khan print(""unknown_var"") Giving syntax error that's why finally statement not running. And print(unknown_var) Giving error that's why it running finally statement. I think now you got your answer. try to run on computer then you can understand more better.
19th Nov 2019, 2:46 AM
Maninder $ingh
Maninder $ingh - avatar
+ 2
Right: print("unknown_var") Wrong: print(""unknown_var"")
18th Nov 2019, 11:22 PM
Ipang
0
try: print(1) print(10 / 0) except ZeroDivisionError: print(unknown_var) finally: print("This is executed last") Guys this is also shows error in line 5 but the main point is this code prints finally statement but with two strings it didn't why??
19th Nov 2019, 12:02 AM
Ansab Khan
Ansab Khan - avatar
0
thanks
19th Nov 2019, 2:57 AM
Ansab Khan
Ansab Khan - avatar