Which keyword allows the creation of a block of code that always runs, regardless of exceptions?
- catch
- except
- finally
- try
In Python, the finally keyword is used to create a block of code that always runs, even if an exception is raised. It is commonly used for cleanup tasks.
Loading...
Related Quiz
- You are assigned to implement a complex object creation scenario where the object’s construction process should be separate from its representation. Which design pattern would you use?
- The ____ function in the functools module is used to transform a method into a class method decorator.
- How would you use a mock object in Python for testing a function that makes an HTTP request?
- What keyword is used to define a function in Python?
- How would you define a class attribute that should not be overridden by subclasses?