From d85aa7a76dd4ec4b5c307058603b2d61463cb62b Mon Sep 17 00:00:00 2001 From: Pascal Lais Date: Wed, 11 Mar 2020 12:55:19 +0100 Subject: [PATCH] Update 'point.py' Add __ne__ operator to class Point --- point.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/point.py b/point.py index 010929f..91322d0 100644 --- a/point.py +++ b/point.py @@ -24,6 +24,9 @@ class Point(): def __eq__(self, other) """Returns True if the points coordinates are the same, else returns False""" return self.get_x() == other.get_x() and self.get_y() == other.get_y() + def __ne__(self, other) + """Returns True if the points coordinates are the different, else returns False""" + return self.get_x() != other.get_x() or self.get_y() != other.get_y() def __str__(self): """Returns the coordinates as a string""" return "(" + str(self.get_x()) + "/" + str(self.get_y()) + ")"