uses pythagoras theorem to calculate the distance between two points in space import math class point def initself x y z self x x self y y self z z def reprself str return fpointself x self y self z def distancea point b point float return math sqrtabsb x a x 2 b y a y 2 b z a z 2 if name main import doctest doctest testmod point1 point 2 1 7 point2 point 1 3 5 print f distance from point1 to point2 is distance point1 point2 distance from point 2 1 7 to point 1 3 5 is 3 0
import math


class Point:
    def __init__(self, x, y, z):
        self.x = x
        self.y = y
        self.z = z

    def __repr__(self) -> str:
        return f"Point({self.x}, {self.y}, {self.z})"


def distance(a: Point, b: Point) -> float:
    
    return math.sqrt(abs((b.x - a.x) ** 2 + (b.y - a.y) ** 2 + (b.z - a.z) ** 2))


if __name__ == "__main__":
    import doctest

    doctest.testmod()