Question 8
Which of the following statements about the exception handling behavior are TRUE? Select ALL that apply.
def safe_divide(x, y):
result = []
try:
result.append("Trying division")
result.append(x // y)
except ZeroDivisionError:
result.append("Division by zero")
else:
result.append("No exception occurred")
finally:
result.append("Cleanup done")
return result
output = safe_divide(10, 0)
print(output)
The output will contain the string "Trying division"
The string "Division by zero" will appear in the output
The division result will be appended to the output
The string "Cleanup done" will always appear regardless of exceptions