The finally block of a try ... except clause

Question Q4.1.2

What is the point of the finally clause? Why not put any statements you want executed after the try block (regardless of whether or not an exception has been raised) after the entire try ... except clause?

Hint: See what happens if you modify Example E4.5 to put the statements in the finally clause after the try block.


Solution

To access solutions, please obtain an access code from Cambridge University Press at the Lecturer Resources page for my book (registration required) and then sign up to scipython.com providing this code.