1
0
Fork 0
This commit is contained in:
Przemysław Kaczmarek 2017-11-28 18:37:51 +01:00
parent b195295736
commit 92127f821f
1 changed files with 5 additions and 1 deletions

View File

@ -8,9 +8,13 @@ dwoma punktami przestrzeni trójwymiarowej. Punkty są dane jako
trzyelementowe listy liczb zmiennoprzecinkowych. trzyelementowe listy liczb zmiennoprzecinkowych.
np. odległość pomiędzy punktami (0, 0, 0) i (3, 4, 0) jest równa 5. np. odległość pomiędzy punktami (0, 0, 0) i (3, 4, 0) jest równa 5.
""" """
import math
def euclidean_distance(x, y): def euclidean_distance(x, y):
pass value=0
for i in range(3):
value+=math.pow((y[i]-x[i]),2)
return math.sqrt(value)
def tests(f): def tests(f):
inputs = [[(2.3, 4.3, -7.5), (2.3, 8.5, -7.5)]] inputs = [[(2.3, 4.3, -7.5), (2.3, 8.5, -7.5)]]