title: How to change numbers around in a list in python
body: <p>I have a list [50,30,20,10,40] and I am trying to exchange the variables.
  So what I want to do is if the first number is greater than the next, we have have to flip them. 
  So this should return [30,20,10,40,50]</p>
  
  <p>The code I have so far is given the l as the list</p>
  
  <pre><code>a=''
  b=''
  c=''
  for i in range(len(l)):
      if (l[i+1]&lt;l[i]):
          a=l[i]
          b=l[i+1]
          c=a
          a=b
          b=c
          print [a,b,c]
      else:
          print listOrig
  </code></pre>