Purpose of else and finally in exception handling
Solution 1:
finally
is executed regardless of whether the statements in the try block fail or succeed. else
is executed only if the statements in the try block don't raise an exception.
Solution 2:
No matter what happens, the block in the finally
always gets executed. Even if an exception wasn't handled or the exception handlers themselves generate new exceptions.