I have no clue how to clearly simplify the requirements for the if statement to run. Is there a simpler way I could have done this? The code is supposed to return True if the number is 2 integers near 10, either being above or below.
def nearten(num):
if (abs(num - 2) % 10) == 0 or (abs(num + 2) % 10) == 0 or (abs(num - 1) % 10) == 0 or (abs(num + 1) % 10) == 0 or num % 10 == 0:
return True
return False