forked from tdwojak/Python2017
Poprawa task03 z labs04
This commit is contained in:
parent
2d6ac6ef66
commit
8f147230c8
@ -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,11 +47,12 @@ 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)
|
||||||
|
|
||||||
print('1st point =', new_point)
|
print('1st point =', new_point)
|
||||||
print('2nd point =', new_point_2)
|
print('2nd point =', new_point_2)
|
||||||
print('1st point + 2nd point = ', new_point_3)
|
print('1st point + 2nd point = ', new_point_3)
|
Loading…
Reference in New Issue
Block a user