MATH SOLVE

4 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