Medium
Fallback Value
Write a decorator factory
fallback(value) that returns value instead of raising when the function fails with any Exception. Decorate parse(s) (int conversion) with @fallback(-1) and print parse for each input token.Input
One line of tokens.
Output
One line.
Sample 1
Input
1 x 3
Output
1 -1 3
Sample 2
Input
abc
Output
-1
Output appears here