0
Who can help me to develope this code?
#This program can calculate Distance between two point #This code needs to be developed c=input("Enter X1,Y1 : ") d=input("Enter X2,Y2 : ") C=c.split(",") D=d.split(",") M=[] N=[] for i in C: m=int(i) M.append(m) for j in D: o=int(j) N.append(o) X=(N[0]-M[0])**2 Y=(N[1]-M[1])**2 res=(X+Y)**0.5 print("The Distance Between is : \n "+ str(res))
1 Odpowiedź
+ 4
# you could use math.hypot:
from math import hypot
x1, y1 = map(int,input("enter x1,y1: ").split(","))
x2, y2 = map(int,input("enter x2,y2: ").split(","))
print("the distance between is:")
print(hypot(x1-x2,y1-y2))