#求兩點座標距離d
x1=eval(input())
y1=eval(input())
x2=eval(input())
y2=eval(input())
print("(",x1,",",y1,")")
print("(",x2,",",y2,")")
#方式1
import math
d=math.pow(math.pow((x1-x2),2)+math.pow((y1-y2),2),0.5)
print("Distance = %.4f" % d)
#方式2
d=(x1-x2)**2+(y1-y2)**2
d=d**0.5
print("Distance = %.4f" % d)
#方式3
d=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2)
d=math.sqrt(d)
print("Distance = %.4f" % d)
沒有留言:
張貼留言