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:
Question
Answer:
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
solved
general
10 months ago
1449