title: How to divide list into k sublists with approximately same values?
body: <p>I would like to divide a list into <code>k</code> sublists each having approx same response value.</p>
  
  <p>I have lists of the form:</p>
  
  <pre><code>L = [[1,2,3,2], [4,5,2,2], [2,3,9,1], [5,7,2,1], [2,3,3,1]]
  </code></pre>
  
  <p>The response value is the last element of each sublist. Here, the response value has the range [1,2]</p>
  
  <p>If k = 2, then the two sublists with approx equal response are A and B:</p>
  
  <pre><code>A = [[1,2,3,2], [2,3,3,1]                 # it has response values 1,2
  B = [[2,3,9,1], [4,5,2,2], [5,7,2,1]]     # it has response values 1,2,1
  </code></pre>
  
  <p>The only thing that came in my mind was to use sorting somehow. But, there may be some pythonic way of doing it. Since, the list L can be very long say 10000, I expect an efficient way of doing it.</p>