Programming for Mathematics Assignment, 20 August 2014 Extend the definition of the class Point (see below) with a function nearestpoint() such that p.nearestpoint() returns the nearest point to p (as a Point object), other than p itself. a. If there are multiple points at the same distance, return any one of them as the nearest one. b. It is possible that there is another point q, different from p, that is at distance 0 from p (i.e. q and p have same coordinates). In such a situation it is OK to return q as the nearest point. Hint: Go through Point.allpoints ("for p in Point.allpoints:") and identify the point that is closest to self, using the function self.distance(p). Note that the current point also belongs to Point.allpoints, so be careful to exclude it from consideration. Note: I have intentionally modified the code to use simultaneous assignment of the form (self.x,self.y) = (a,b) to remind you that this can be done, and to illustrate that it can add clarity to your code by grouping together simultaneous updates to related variables. ====================================================================== from math import * class Point: allpoints = [] def __init__(self,a,b): (self.x,self.y) = (a,b) Point.allpoints.append(self) def setpoint(self,a,b): (self.x,self.y) = (a,b) def getpoint(self): return(self.x,self.y) def distance(self,p): return(sqrt((p.x-self.x)**2 + (p.y-self.y)**2)) ======================================================================