# Homework 27, problem 1 -- solution. import math class Point: def __init__(self, x, y): self.x = x self.y = y def distance(self, other): dx = self.x - other.x dy = self.y - other.y return math.sqrt(dx * dx + dy * dy) def move(self, dx, dy): self.x = self.x + dx self.y = self.y + dy a = Point(0, 0) b = Point(3, 4) print(a.distance(b)) a.move(1, 1) print(a.x, a.y) print(a.distance(b))