Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python

How to do combinational multiplier points and get the highest/lowest value?

Hi guys,

this question might be not included in any python-related course in this forum/community, but I'm wondering on how to do combinational multiplier in python.

so my case is to find the closest pair of points/coordinates from any given data. To get that, we can easily use euclidean distance to weigh which one is closest by simply choosing the lowest value of the result of euclidean distance. (see euclidean distance further in this link http://www.cut-the-knot.org/pythagoras/DistanceFormula.shtml)

to give you a rough picture, these are inputs and outputs I expect to come :

  1. input (2x8) : -262972 508697 -311943.65362731507 370239.3559213022 742431 -772652 -346046 696615.3537438104 194172 103527 726621.8167057682 -813087.8844925504 167923 -312455.0459619701 499664.42762545496 72395.09685360803

output : 3:742431 -772652 6:726622 -813088

  1. input (4x4) : 653725 -422117.9078937047 -483855 -579967 -543446.8852285817 -319599.12096280814 130119 42410.4020668423 -800188 58364 586736 -409415 -607784.1676060366 400299 -925526.2019860733 -779617

output : 2:-543447 -319599 130119 42410.4 3:-800188 58364 586736 -409415

note: input is a multidimensional points, with different point/coordinate for every row. output is determining the closest pair of coordinates from the whole data, and show it in form of its index and value.

Thanks so much guys, highly appreciated any answer below.