I need to validate two given inputs before I call the add function: Ff any input is not an integer I should get invalid input or error message, if both are integers I should get the sum.
import re
def my_dec(arg1,arg2):
x = re.compile(r"[^0-9]")
if x.search(arg1) and x.search(arg2):
return add(a,b)
else:
print("invalid input")
@my_dec(arg1,arg2)
def add(a,b):
return a + b
print(add(2,3))
I get function not defined errors in loops, but I don't know how to overcome it.