Python
def approx_equal(x, y, tol):
Returns True if and only if x and y are within tol of eachother.
Answer
def approx_equal(x, y, tol): return abs(x – y) <= tolprint(approx_equal(1, 2, 1))print(approx_equal(4, 3, 1))print(approx_equal(4, 3, 0.99))print(approx_equal(-1.5, 1.5, 3))