diff options
| author | Andrew Guschin <saintruler@gmail.com> | 2021-04-04 21:45:11 +0400 |
|---|---|---|
| committer | Andrew Guschin <saintruler@gmail.com> | 2021-04-04 21:45:11 +0400 |
| commit | f534258a4428319e1033dbc4c0afaf29b8fd9b05 (patch) | |
| tree | dfcc9eb30d66fa7d415fa27ad44d40a1615b76b1 /python-func/task10.py | |
| parent | e9208ade043f2304225d1e1150f57fa31aa49c28 (diff) | |
Переопределил оператор __eq__ в классе Point
Diffstat (limited to 'python-func/task10.py')
| -rw-r--r-- | python-func/task10.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/python-func/task10.py b/python-func/task10.py index 8c548e1..1484f2d 100644 --- a/python-func/task10.py +++ b/python-func/task10.py @@ -6,6 +6,9 @@ class Point: self.x = x self.y = y + def __eq__(self, other): + return self.x == other.x and self.y == other.y + def dist(p1: Point, p2: Point) -> float: return sqrt((p2.x - p1.x) ** 2 + (p2.y - p1.y) ** 2) |