Update 'point.py'
All checks were successful
continuous-integration/drone/push Build is passing

Random coordinates are now float values.
This commit is contained in:
2020-03-11 12:35:01 +01:00
parent 0d30b0b123
commit 3bfdab784b

View File

@@ -11,7 +11,7 @@ class Point():
self.set_y(y)
def set_x(self, new_x):
"""Set the X-Coordinate of the Point"""
self.__x = int(new_x)
self.__x = new_x
def get_x(self):
"""Returns the X-Coordinate of the Point"""
return self.__x
@@ -29,7 +29,7 @@ class Point():
def get_random(min_x=0, max_x=100, min_y=0, max_y=100):
"""Set the point to a random place inside the boundaries"""
return Point(random.randint(min_x, max_x), random.randint(min_y, max_y))
return Point(random.uniform(min_x, max_x), random.uniform(min_y, max_y))
def sort_set(point_set, sort_by_y=False):
"""Sort a Point set using merge sort"""