-3

How should I write a function in python that accepts 3 floating value points as parameters and return true as long as the first 2 parameters are equal within the tolerance of the third parameter?

4

1 回答 1

2

这很简单:

def within_tolerance(a, b, tol):
  return abs(a - b) <= tol
于 2013-11-15T01:50:01.983 回答