📜  python代码示例中的距离公式

📅  最后修改于: 2022-03-11 14:46:23.625000             🧑  作者: Mango

代码示例3
from math import sqrt
def main():
    point1x, point1y = eval(input("Please enter coordinates of Point1 (use commas) "))
    point2x, point2y = eval(input("Please enter coordinates of Point2 (use commas)"))
    
    Distance = sqrt((point1x-point2x)**2 + (point1y-point2y)**2)
    print("The distance between this two points is", str(round(Distance, 4))+" units")