Pretend there are three float values being passed through this function. The function takes the first two values and subtracts the second from the first. If the result of that subtraction is less than or equal to the value of the parameter tolerance, it returns true. I want to set up another test in there. How do you tell a function to return None if the arguments passed to it are not floats?
def assert_within_tolerance(x_1,x_2,tolerance):
result=abs(x_1-x_2)
if result<=tolerance:
return True
if result>tolerance:
print('\nThe result was greater than the tolerance')
return None