title: sorting a list in python without the sorted function
body: <pre><code>import sys
  import pdb
  
  a = [5, 2, 4, 1]
  
  for i in range(len(a)):
      for j in range(len(a) - 1):
          if a[j] &gt; a[j+1]:
              t = a[j]
              a[j] = a[j+1] 
              a[j] = t
  
  print a                   
  sys.exit()
  </code></pre>
  
  <p>I just tried a C program in Python – a normal sort without the <code>sorted</code> function. Why am I not getting the sorted list?</p>