courageandcraftla
Calculators
General
Algebra
Geometry
Coordinate-geometry
Statistics
Calculus
Qna
Math
courageandcraftla
courageandcraftla
Home
General
Algebra
Geometry
Coordinate-geometry
Statistics
Calculus
Qna
Math
MATH SOLVE
Home
General
Assign point_dist with the distance between point (x1, y1) and point (x2, y2). the calculation is: d...
5 months ago
Q:
Assign point_dist with the distance between point (x1, y1) and point (x2, y2). the calculation is: distance = squarerootof( (x2 - x1)2 + (y2 - y1)2 ). sample output for the given program:
Accepted Solution
A:
import math def calculateDistance(x1,y1,x2,y2): dist = math.sqrt((x2 - x1)**2 + (y2 - y1)**2) return dist distance = calculateDistance(2,4,6,8) print distance