Who can help me to develope this code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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))

19th Mar 2021, 6:53 AM
No 112
No 112 - avatar
1 Answer
+ 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))
19th Mar 2021, 7:00 AM
visph
visph - avatar