Is there a way to make my code simpler/more Pythonic?Given three int values (a, b, c), return True if one of b or c is close  (differing from a by at most 1), while the other is far, differing  from both other values by 2 or more. Note: abs(num) computes the  absolute value of a number. close_far(1, 2, 10)  Trueclose_far(1, 2, 3)  Falseclose_far(4, 1, 3)  Truedef close_far(a, b, c):    if abs(a - b) <= 1 or abs(a - c) <= 1:        if abs(c - a) >= 2 <= abs(c - b) or abs(b - a) >= 2 <= abs(b - c):            return True           return False
Using logic to compare absolute values
python
Some tips:You could replace the innermost if with returnAdding doctests would be niceNote that abs(a - b) is the same as abs(b - a). To avoid repeated calculation of abs values, it would be more optimal to cache in local variablesLike this:def close_far(a, b, c):        >>> close_far(1, 2, 10)    True    >>> close_far(1, 2, 3)    False    >>> close_far(4, 1, 3)    True        diff_ab = abs(a - b)    diff_ac = abs(a - c)    if diff_ab <= 1 or diff_ac <= 1:        diff_bc = abs(c - b)        return diff_ac >= 2 <= diff_bc or diff_ab >= 2 <= diff_bc    return False