You can achieve a longer version of the code using a for loop instead of a list comprehension. Here is the longer version:
main.py137 chars5 lines
In this version, instead of using a list comprehension, we iterate over each point in the points_array and calculate the Euclidean distance between the target_point and the current point. Then, we append a tuple of (point, distance) to the distances list.
gistlibby LogSnag