Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2022
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.37 KB | None | 0 0
  1. def dist(loc_a, loc_b):
  2.     return (pow(loc_b[0] - loc_a[0], 2) + pow(loc_b[1] - loc_a[1], 2)) ** 1/2
  3.  
  4. points = [(2.8, 9.8), (0.3, 8.3), (4.4, 8.8), (6.8, 7.4), (4.1, 0.3), (4.5, 0.0), (7.6, 1.1), (5.0, 8.2), (7.7, 1.8), (3.4, 6.9), (4.8, 3.2), (0.7, 7.9)]
  5. distances = []
  6. my_loc = (0, 0)
  7.  
  8. for point in points:
  9.     distances.append(dist(my_loc, point))
  10. print(distances)
  11.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement