title: startswith() function not working in while loop but works in for loop? python
body: <p>not working while-loop</p>
  <pre><code>i=0
  
  l1=[&quot;rohan&quot;,&quot;sachin&quot;,&quot;sam&quot;,&quot;raj&quot;]
  
  while i&lt;len(l1):
  
      if l1[i].startswith('s'):  #if i comment out  this line it is working 
  
          print(&quot;GREET &quot;+l1[i])
  
          i=i+1
  </code></pre>