Answer to Question #174711 in Python for zain ul abdeen

Question #174711

Make two 2D-points, points in cartesian plane. Calculate the distance between these points.


1
Expert's answer
2021-03-28T11:19:31-0400
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)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS