Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- class Point:
- def __init__(self, x, y):
- self.x = x
- self.y = y
- @classmethod
- def calculate(cls, p1, p2):
- cls.distance = math.sqrt(math.pow(p1.x - p2.x, 2) + math.pow(p1.y - p2.y, 2))
- return f"{cls.distance:.3f}"
- p1_coordinates = list(map(int, input().split(" ")))
- p1 = Point(p1_coordinates[0], p1_coordinates[1])
- p2_coordinates = list(map(int, input().split(" ")))
- p2 = Point(p2_coordinates[0], p2_coordinates[1])
- print(Point.calculate(p1, p2))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement