Poprawa task03 z labs04

This commit is contained in:
s45156 2018-01-24 12:36:03 +01:00
parent 2d6ac6ef66
commit 8f147230c8

View File

@ -16,7 +16,7 @@ class Point:
if is_numeric(coordinates): if is_numeric(coordinates):
self.coordinates = coordinates self.coordinates = coordinates
else: else:
raise Exception("Coordinates are not numeric") raise DimensionError("Coordinates are not numeric")
def to_string(self): def to_string(self):
return str(self.coordinates) return str(self.coordinates)
@ -47,7 +47,8 @@ def add(point_1, point_2):
if __name__ == "__main__": if __name__ == "__main__":
new_point = Point([5, 10, 12, 6]) new_point = Point([5, 10, 12, 6])
print(new_point.__len__()) new_point.to_string()
new_point.__len__()
new_point_2 = Point([12, 23, 21, 16]) new_point_2 = Point([12, 23, 21, 16])
print(new_point_2.__str__()) print(new_point_2.__str__())
new_point_3 = add(new_point, new_point_2) new_point_3 = add(new_point, new_point_2)