Try,except,finally Keywords

try:
x > 3
except:
print(“Something went wrong”)
else:
print(“Nothing went wrong”)
finally:
print(“The try…except block is finished”)

As we know “except” will run when error will be there in “try” statement.And when error will not there "else " will run.So this program should run except statement.But in Jupyter notebook it is running “else” statement instread of “except”.

I didn’t initialized the variable x, (del x is used) and code is running fine, we expect except block to be executed and actually it is executed.
Here’s the screenshot,

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.