title: Traversal through a string with a loop in Python
body: <p>My code below is not generalized; it handles each line of output as a special case.  How I could get the same output using a while or for statement?</p>
  
  <pre><code>string = "Apple"
  i = 0
  
  one = string[0:i+1]
  two = string[0:i+2]
  three = string[0:i+3]
  four = string[0:i+4]
  five = string[0:i+5]
  
  print(one)
  print(two)
  print(three)
  print(four)
  print(five)
  </code></pre>
  
  <p>I have the following result:</p>
  
  <pre><code>A
  Ap
  App
  Appl
  Apple
  </code></pre>