1-D intersection of lines given begin and end points
Using explicit booleans is a common antipattern:

check = False
if condition:
    check = True
return check


is equivalent to much more transparent (and preferable)

return condition

Segments do not intersect if a lies completely to the left, or completely to the right of b. Assuming that segments are themselves sorted:

def is_intersect_3(a, b):
    return not (a[1] &lt; b[0] or a[0] &gt; b[1])

is_intersect_2 fails badly on floats