Question: Write a function distance(p,q) that takes two Points p and q and returns the Euclidean distance between p and q. Then write another function double(p)
Write a function distance(p,q) that takes two Points p and q and returns the Euclidean distance between p and q. Then write another function double(p) that modifies p so that the values of its x- and y- coordinates are doubled.
Point:

15 # Question 5 16 class Point: 17 18 19 20 def_init_(self, x, y): self.y-y return "(%.2t, %.2f)" %(self.x, self.y) return "Point(X-Xr, y-Xr)" %(self.x, self.y) return isinstance (other, Point) and self.xother.x and self.yother.y def str(self): def _repr_(self): 24 def eq (self, other): 26 27 p1 -Point (3,5) 28 p2=Point (2,5) 29 p3= Point (3,5) 0 print(p1) 1 print(repr(p1)) 32 print (p1 p2) print (p1 p3)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
