If I input an arbitrary amount of points [x1,y1].....[xn,yn] into a function I need to somehow return/print the shortest distance between all of the points. I understand how to find the distance between two points (fairly easy and straight forward), but how do I take an arbitrary amount of points and test each point with one another without testing each point with itself.

Hint ...

import itertools as it

# create non-repeating pairs
print(list(it.combinations('ABCD', 2)))

''' result ...
[('A', 'B'), ('A', 'C'), ('A', 'D'), ('B', 'C'), ('B', 'D'), ('C', 'D')]
'''

Note:
Instead of 'ABCD' use a sequence of (x, y) coordinate points.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.