Here is an example:
def f(x):
if x == 0:
raise ValueError("Input is zero")
return
print(f(0))
which results in
Traceback (most recent call last):
File "..\file.py", line 25, in <module>
print(f(0))
File "..\file.py", line 22, in f
raise ValueError("Input is zero")
ValueError: Input is zero
I want line 5, raise ValueError("Input is zero"), removed from the output.
I do not support try and except, so I will be grateful if you do not implement them in your answer(s). Remove raise if you wish, and use another method.
Here is an example made by a standard library:
from math import factorial as f
print(f(-1))
Output:
Traceback (most recent call last):
File "..\file.py", line 29, in <module>
print(f(-1))
ValueError: factorial() not defined for negative values
I assume (this part of) math is not using raise.