given four real numbers representing cartesian coordinates: (x1,y1),(x2,y2). write a function distance(x1, y1, x2, y2) to compute the distance between the points (x1,y1) and (x2,y2). read four real numbers and print the resulting distance calculated by the function

Sagot :

The distance between fours points are calculated with a function 'distance'.

Given four real numbers representing cartesian coordinates: (x1,y1),(x2,y2). write a function distance(x1, y1, x2, y2) to compute the distance between the points (x1,y1) and (x2,y2).

Read four real numbers and print the resulting distance calculated by the function

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

Therefore, the above program is used to calculate the distance between points and print the result.

To learn more about Python refer here

https://brainly.com/question/16397886

#SPJ4