def compare(n1, n2, delta):
return abs(n1-n2) <= delta
The function returns true iff:
n1 > n2 :
n1-n2 <= delta
[OR]
n1 < n2 :
n1-n2 <= -delta
solved Determining if two numbers are close in value by defining a function
def compare(n1, n2, delta):
return abs(n1-n2) <= delta
The function returns true iff:
n1 > n2 :
n1-n2 <= delta
[OR]
n1 < n2 :
n1-n2 <= -delta
solved Determining if two numbers are close in value by defining a function