Update str operator of Point class

The coordinates now get rounded to 2 decimals
This commit is contained in:
2020-03-11 18:09:43 +01:00
parent 004408e37f
commit d891b586b4

View File

@@ -29,7 +29,7 @@ class Point():
return self.get_x() != other.get_x() or self.get_y() != other.get_y() return self.get_x() != other.get_x() or self.get_y() != other.get_y()
def __str__(self): def __str__(self):
"""Returns the coordinates as a string""" """Returns the coordinates as a string"""
return "(" + str(self.get_x()) + "/" + str(self.get_y()) + ")" return "(" + str(round(self.get_x(), 2)) + "/" + str(round(self.get_y(), 2)) + ")"
def draw(self): def draw(self):
"""TODO: Draw the point in a canvas""" """TODO: Draw the point in a canvas"""