For example, in a situation where I have 100 different locations, I want to find the farthest location from the others. so I thought of a for loop that would take the difference of each position from the other 99 and add it to a list. the same locations in the loop should not meet.
I thought of making a condition for it. it works but I'm not sure if it's the right approach. What approach should I take in such a situation?
def getDifferenceCoord(t1, t2):
expDist = (t1[0] - t2[0]) ** 2 + (t2[1] - t1[1]) ** 2
dist = expDist ** 0.5
return dist
allDistance = []
for i in range(len(locationList)):
for j in range(len(locationList) - 1):
if i == j:
j = 99
allDistance.append(getDifferenceCoord(locationList[i], locationList[j]))