title: while infinite loop after 2 loops
body: <p>I basically want to put each letter to a different list so that the first letter goes in the first list until the <code>kth</code> letter. Then the <code>k+1th</code> letter should go in the <code>k-1th</code> list and the next to the <code>k-2th</code> list etc. The fact is that after the second loop the while enters in an infinite loop</p>
  <pre><code>def f(s,k):      
   l = [[] for i in range(k)]
   i = 0
   while i &lt; len(s):
     for j in range(0,k):
       l[j].append(s[i])
       print(l)
       i += 1
     for k in range(k-2,-1,-1):
       l[k].append(s[i])
       print(l)
       i += 1
   return l
  </code></pre>