Program for distance between two points by python | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

Program for distance between two points by python

python

10th Oct 2017, 4:34 PM
Krishna K
Krishna K - avatar
3 Respuestas
+ 4
We can form a right triangle with 2 points and Pythagoras's theorem would do the job. In other cases it would be kinda trivial for straight-line. 😉
10th Oct 2017, 5:18 PM
Zephyr Koo
Zephyr Koo - avatar
+ 2
distance = sqrt((point1x-point2x)**2+(point1y-point2y)**2)
10th Oct 2017, 4:36 PM
Dapper Mink
Dapper Mink - avatar
+ 2
Use euclidean distance formula to calculate distance between two points. dist= √(( x1-x2)^2 +(y1-y2)^2)
10th Oct 2017, 10:14 PM
Vijay
Vijay - avatar