title: How do you sort a list with a while loop in Python?
body: <p>How do you sort a list with a while loop? Having a bit of a problem, thanks very much in advance.</p>
  
  <pre><code>a = [12,0,39,50,1]
  
  first = a[0]
  
  i = 0
  j = 1
  while i &lt; len(a):
      if a[i] &lt; first:
          tmp = a[i]
          a[i] = a[j]
          a[j] = tmp
      i += 1
  
  print(a)
  </code></pre>