Make two 2D-points, points in cartesian plane. Calculate the distance between these points.
class Point:
x = 0
y = 0
P1 = Point()
print("Enter Point 1 x: ")
P1.x = input()
print("Enter Point 1 y: ")
P1.y = input()
P2 = Point()
print("Enter Point 2 x: ")
P2.x = input()
print("Enter Point 2 y: ")
P2.y = input()
distance = ((float(P2.x) - float(P1.x)) ** 2 + (float(P2.y) - float(P1.y)) ** 2) ** 0.5
print("Distance between two points is: ", distance)
Comments
Leave a comment