Mark As Completed Discussion

Adding Dimensions

Suppose we have 3 Dimensions, the points now become (x1, y1, z1) and (x2, y, z2), our formula simply changes to:

= √[(x2-x1)² + (y2-y1)² + (z2-z1)²]

PYTHON
1#3D
2p_1 = (6,5,4)
3p_2 = (3,2,1)
4
5euclidean_distance = distance.euclidean(p_1, p_2)
6print('Euclidean Distance between', p_1, 'and', p_2, 'is', euclidean_distance)

Output: Euclidean Distance between (6, 5, 4) and (3, 2, 1) is 5.196152422706632

As you can see we just add it to our formula, easy right?!