title: Implement sliding window with three input variables, list, window size and forward move size using python?
body: <p>I have a list like this,</p>
  
  <pre><code>  l=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
  </code></pre>
  
  <p>Now I want to apply a sliding window of size five (n1), but it will move forward by three steps(n2).</p>
  
  <p>The desired output I am looking for if n1=5 and n2=3 is,</p>
  
  <pre><code>[1,2,3,4,5],[4,5,6,7,8],[7,8,9,10,11],[10,11,12,13,14],[13,14,15,16,17],[16,17,18,19,20]
  </code></pre>
  
  <p>I could use following code,</p>
  
  <pre><code>[ thelist[x:x+size] for x in range( len(thelist) - size + 1 ) ]  # but this returns only one 
  forward move.
  </code></pre>
  
  <p>How to move it more than 1 ?</p>
  
  <p>I can use for loop, but execution time will be huge.</p>
  
  <p>How to implement it with less execution time ?</p>