I wish to compare a signal return against a standard with a tolerance, I have some simple code which works fine but wondered if there was a more pythonic method of doing it as it feels clunky. I couldn't find a similar question but would appreciate if someone else can.
Code
tol = 1
a = 5
b = 7
if a >= b+tol or a<= b-tol:
print("a is out of tolerance")
Question was closed as someone thought it was similar to something I couldn't understand. Found what I was looking for:
if abs(a-b)>tol: