title: Why don't these modified bubble sort algorithms produce the same order in python3?
body: <p>Objective: to order list by first two characters only, when comparing two elements from a list if they are the same then keep the original order.</p>
  <p><strong>Snippet #1</strong></p>
  <pre><code>l= []
  for i in range(int(input())):
      l.append(input().split())
  
      for i, j in enumerate(l):
          for b, c in enumerate(l[:-1]):
              if l[b][:2] &gt; l[b+1][:2]:
                  l[b],l[b+1] = l[b+1], l[b]
  l = [x[0] for x in l]
  print( '\n'.join(str(p) for p in l))
  </code></pre>
  <p>The output from #1:
  The items are alphabetical when considering the entire text, but I only want to consider the first two characters of each string and compare those. When they are the same, I want the original order of those which were compared.</p>
  <p><a href="https://i.stack.imgur.com/YOqs3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YOqs3.png" alt="enter image description here" /></a></p>
  <p><strong>Snippet #2</strong></p>
  <pre><code>l = ['Hilbert','Godel','Poincare', 'Ramanujan','Pochhammmer']
  for i, j in enumerate(l):
      for b, c in enumerate(l[:-1]):
          if l[b][:2] &gt; l[b+1][:2]:
              l[b],l[b+1] = l[b+1], l[b]
  #l = [x[0] for x in l]
  print( '\n'.join(str(p) for p in l))
  </code></pre>
  <p>Output from #2:
  This output is what I was expecting.</p>
  <p><a href="https://i.stack.imgur.com/sR5sn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sR5sn.png" alt="enter image description here" /></a></p>