Update str operator of Point class
The coordinates now get rounded to 2 decimals
This commit is contained in:
2
point.py
2
point.py
@@ -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"""
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user