Medium
Turn Errors Into Messages
Write a decorator
safe that catches any exception from the function and returns error: ExceptionName instead. Decorate divide(a, b) returning a // b. Read pairs until END and print each result.Input
Lines 'a b', then END.
Output
Lines.
Sample 1
Input
10 2 1 0 END
Output
5 error: ZeroDivisionError
Sample 2
Input
x 2 END
Output
error: ValueError
Output appears here