title: Python shortest distance points
body: <blockquote>
    <p>Write a function called <code>dist</code> 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.<br>
    Use <code>dist</code> in a nested loop inside <code>shortestDist</code> to compare each element of the list of points with every element in the list after it. So, basically, find the shortest distance between points in a list.</p>
  </blockquote>
  
  <p>Here's what I have so far:</p>
  
  <pre><code>        sample= [[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]]
  
          def dist(p0, p1):
              return (((p0[0] - p1[0])**2) + ((p0[1] - p1[1])**2))**.5
  
  
          def shortestDist(sample):
              distances = []
              for i in range(len(sample)-1):
                  for j in range(i+1, len(sample)):
                      distances += [dist(sample[i],sample[j])]
              return(min(distances))
  </code></pre>
  
  <p>That finds the distance alright between two points. I just need some help figuring out how to start writing <code>shortestDist</code> to compare all points and keep track of the shortest distance. UPDATE: The error was resolved and I'm good to go now. Thank you to everyone for their assistance!</p>