def distance(a, b):
    return sqrt((a.x - b.x) ** 2 + (a.y - b.y) ** 2)

def is_between(a, c, b):
    return distance(a, c) + distance(c, b) == distance(a, b)
How can you determine a point is between two other points on a line segment?