title: Make alternate letters of a word capital in python using while loop
body: <p>I want to make alternate letter capital for any given word. So I create below function. This is further part of previous question I asked. I got an answer using for loop. But I am struggling with while loop.</p>
  
  <pre><code>def farrange(word):
      finaloutput = ''
      i = 0
      while i &lt; len(word):
          if i%2 == 0:
              finaloutput = finaloutput + word[i].upper()        
          else:
              finaloutput = finaloutput + word[i].lower()
          i = i + 1 
      return finaloutput
  print(farrange("abc")
  </code></pre>
  
  <p>In this case, I am using i as loop variable and same value of it goes as index in a word. So I feel this should work, but this time, I get only first letter in answer. nothing else. To check if counter is not stuck in while loop, i changed while condition as while i &lt; 3. But no use. It again returns output as a.</p>