Lecture Notes on 6 Sep 2023 import math class Point (object): # constructor def __init__ (self, x = 0, y = 0): self.x = x self.y = y # get the distance to another Point object def dist (self, other): return math.hypot (self.x - other.x, self.y - other.y) # string representation of a Point def __str__ (self): return '(' + str(self.x) + ', ' + str(self.y) + ')' # test for equality of two Point objects def __eq__ (self, other): tol = 1.0e-6 return ((abs(self.x - other.x) < tol) and (abs(self.y - other.y) < tol)) def main(): # create Point objects a = Point() b = Point (3, 4) c = Point (3, 4) # print the Point objects print (a) print (b) # print the distance between Point objects print (a.dist(b)) print (b.dist(a)) # test for equality if (b == c): print ("Points objects are equal") else: print ("Point objects are not equal") main()