title: Bubble Sort following an algorithm
body: <p>Im trying to implement a code in python for bubble sort using an algorithm:<br>
  I managed to write a code using double for, and it works fine. </p>
  
  <pre><code>A=[43,21,12,80,3,2,35]
  lengthOfList = len(A)
  for i in range (lengthOfList):
      for k in range(lengthOfList-1, i,-1 ):
          if ( A[k - 1]&gt; A[k]):
              temp = A[k]
              A[k] = A[k-1]
              A[k-1] = temp
  print A
  </code></pre>
  
  <p>Im trying to adopt the login of this algorithm more than 3 hours now but, I cant get it work:</p>
  
  <pre><code>procedure bubbleSort( A : list of sortable items )
     n = length(A)
     repeat 
       swapped = false
       for i = 1 to n-1 inclusive do
         #if this pair is out of order
         if A[i-1] &gt; A[i] then
           # swap them and remember something changed
           swap( A[i-1], A[i] )
           swapped = true
         end if
       end for
     until not swapped
  end procedure
  </code></pre>
  
  <p>Im kind of stuck on the repeat &amp; until stage. I know I have to use while, but I cant get the logical idea of how to implement that using while</p>