title: implement selection sort in python?
body: <p>This may seem like a simple question but when I attempted to implement selection sort in Python, I do not get a sorted list. Is there something wrong with my implementation? </p>
  
  <pre><code>def selectionSort (B, annotate=True):
      for i in range(len(A)):
      for j in range(1,len(A)):
          if(A[i] &gt; A [j]):
              A[i], A[j] = A[j], A[i]
  
  
  
  A = [5, 4, 3, 2, 1]
  A_sorted = selectionSort (A)
  print ("Sorted " + str(A) + " = " + str(A_sorted))
  
  A = [10, 7, 8, 40, 2, 5]
  A_sorted = selectionSort (A)
  print ("Sorted " + str(A) + " = " + str(A_sorted))
  </code></pre>
  
  <p>Here's what I get:</p>
  
  <pre><code>&gt;&gt;&gt; (executing lines 1 to 74 of "selection_sort_103_v2.py")
  
  Sorted [1, 5, 4, 3, 2] = None
  
  Sorted [2, 40, 10, 8, 7, 5] = None
  </code></pre>