title: Algorithm to find least sum of squares of differences
body: <p>Basically this algorithm I'm writing takes as input a List L and wants to find a number x such that all items in L, i,  minus x  squared and summed are minimized.  Find minimum x for the sum of <code>abs(L[i]-x)**2</code>.  So far my algorithm is doing what it's supposed to, just not in the cases of floating.  I'm not sure how to implement floating.  For example <code>[2, 2, 3, 4]</code> ideally would yield the result <code>2.75</code>, but my algorithm isn't currently capable of yielding floating integers.</p>
  
  <pre><code> def minimize_square(L):
       sumsqdiff = 0
       sumsqdiffs = {}
       for j in range(min(L), max(L)):
               for i in range(len(L)-1):
                       sumsqdiff += abs(L[i]-j)**2
               sumsqdiffs[j]=sumsqdiff
               sumsqdiff = 0
       return min(sumsqdiffs, key=sumsqdiffs.get)
  </code></pre>