title: Sorting/grouping odd and even numbers in odd and even segregated list
body: <p>I have a unsorted list of number with even and odd. I need to segregate odd and even numbers in sorted order.</p>
  
  <p>For example:</p>
  
  <pre><code>List = [5,6,4,7,11,14,12,1,3]
  </code></pre>
  
  <p>Expected output :</p>
  
  <pre><code>[4,6,12,14,1,3,5,7,11]
  </code></pre>
  
  <p>My program to segregate the odd and even numbers.</p>
  
  <pre><code>L = [5,6,4,7,11,14,12,1,3]
  def segregateEvenOdd(L):
      left,right = 0,len(L)-1
      while left &lt; right:
          while (L[left]%2==0 and left &lt; right):
              left += 1
          while (L[right]%2 == 1 and left &lt; right):
              right -= 1
          if (left &lt; right):
              L[left],L[right] = L[right],L[left]
              left += 1
              right = right-1
  
  print segregateEvenOdd(L)
  
  output : [12, 6, 4, 14, 11, 7, 5, 1, 3]
  </code></pre>
  
  <p>I am trying to sort the list using insertion sort, couldn't get right output. Any way to sort this easily</p>