def overlap(x1,x2,x3,x4):
    """overlap take 4 numbers, x1,x2,x3,x4, that are positions 
        for 2 lines: (x1,x2) and (x3, x4).
        It returns a boolean indicating whether the lines overlap
    """
    #There are only 2 situations where the two lines do not overlap:
    #  one of them must have both points smaller than the other two or 
    #  they both must be bigger.
    if x1 < x3 and x1 < x4: 
        if x2 < x3 and x2 < x4:
            return False # both points smaller
    if x1 > x3 and x1 >  x4:
        if x2 > x3 and x2 > x4:
            return False # both points bigger
    return True