title: How can I slice a list to get every 2 consecutive elements of the list in new lists?
body: <p>Say you have a list <code>[1,2,3,...,99,100]</code></p>
  
  <pre><code>import numpy as np
  ls = np.linspace(1,100,100)
  </code></pre>
  
  <p>Say you fiddle around with the slice notation to find ones that works for you. </p>
  
  <pre><code>print(ls[:2])
  &gt;&gt; [ 1.  2.]
  
  print(ls[::2])
  &gt;&gt; [  1.   3.   5.   7.  ...  97.  99.]
  </code></pre>
  
  <p>How can I slice the data in such a way that I can get</p>
  
  <pre><code>[1,2],[3,4],[5,6],[7,8],...,[99,100]
  </code></pre>
  
  <p><code>##</code> perhaps not important but my purpose is to adapt this to my dataset, where the values in the lists denote the numerical subscript of another list of values (other_values[index]) that are to be compared. Is it possible to combine slicing with arrays?</p>