Question: In Python please The distance between 2 points (xiv), (x,y) on a Cartesian plane is given by Pythagoras: (22 21)2 + (y2 y)2 Write a

In Python please
The distance between 2 points (xiv), (x,y) on a Cartesian plane is given by Pythagoras: (22 21)2 + (y2 y)2 Write a function named shortest_dist that will take a (nested) list of points as its only argument and return the shortest distance between any two points in the list. You can assume that there will be at least two points in the list. Each point in the list is represented by a list of two elements: [ xy,], [x,y], ... ,[xy,]] Note that this will require an "all-pairs" comparison. Avoid comparing a point with itself! This problem will be easier if you break it into two components as follows: . Write a function called dist that takes in two points (so two lists of two elements each), and computes the distance between them. Make sure this works on the example below before proceeding to the next step. Use dist in a nested loop inside shortest_dist to compare each element of the list of points with every element in the list after it (choose the range on your inner loop carefully to avoid comparing a point with itself or anything before it). Examples: >>> dist([10,78], [-2,50]) 30.463092423455635 >>> shortest_dist ([[8,-5], [0,9], [8,1], [3,4], [-10,-4]]) 5.830951894845301 >>> shortest_dist ([[45, -99], [24, 83], [-48, -68], [-97, 99], [-8, -77], [-2, 50], [44, 41], [-48, -58), [-1, 53), [14, 86], [31, 94], [12, -91], [33, 50], [82, 72], [83, -90], [10, 78], [7, -22], [90, -88], [-21, 5], [6, 23]]) 3.1622776601683795
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
