Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- class Punto:
- def __init__(self,x,y):
- self._x = x
- self._y = x
- def x(self):
- return self._x
- def y(self):
- return self._y
- def distanza_da(self, p):
- dx = self.x() - self.x()
- dy = self.y() - self.y()
- return math.sqrt(dx * dx + dy * dy)
- def __str__(self):
- return f"({self._x}, {self._y})"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement