# a2_example.py class Point2(object): def __init__(self, x, y): self.x = float(x) self.y = float(y) def dist_sqr(a, b): """Return: the square of the distance between the points a and b.""" return (a.x - b.x)**2 + (a.y - b.y)**2 def farthest_from_origin(a, b): """Return: the point that is closest to the point (0, 0).""" origin = Point2(0, 0) if dist_sqr(origin, a) > dist_sqr(origin, b): return a else: return b p = Point2(1, 2) q = Point2(2, 3) r = farthest_from_origin(p, q)