title: How to compare two adjacent items in the same list - Python
body: <p>I am searching for a way to compare two adjacent items in a list, eg. comparing which has a higher value, and then I will sort them accordingly. It is a list the user will be inputting, so it is not a case of just 
  <code>if l[1] &gt; l[2]</code>, as I will not know the length of the list, so
  I will need a general statement for use in a for loop.</p>
  
  <p>I had the idea of having something akin to 
      <code>for i in l:
      if x &gt; i[index of x + 1]</code>
   but do not know how to find the index of the variable.
  Any help appreciated, Thank you</p>
  
  <p>EDIT: I am aware of the built in sort function, but just wanted to practice coding and algorithm-writing by creating my own :)</p>