title: How to iterate over successively-increasing-length slices of the characters in a string?
body: <p>I'm trying to iterate over a string in a specific way but encountered some problems and got confused.</p>
  
  <pre><code>input = "abcdefghijkl"
  
  def iterate_chars(word):
      for i in range(len(word)):
          sliced = word[:i]
          print(i)
          print(result)
  </code></pre>
  
  <p>But in this piece of code <code>i</code> prints 0 and therefore nothing is printed for result. 
  If I try to iterate over <code>for i in word</code>, I get the following for sliced:</p>
  
  <pre><code>TypeError: slice indices must be integers or None or have an __index__ method
  </code></pre>
  
  <p>What I need is for the programm to iterate over a given string character by character starting at position <code>[2]</code>. So the output will look like this:</p>
  
  <pre><code>ab
  abc
  abcd
  abcde
  abcdef
  etc.
  </code></pre>
  
  <p>I've also tried this:</p>
  
  <pre><code>for i in range(2, len(word), 1) # prints nothing, doesn't start loop
  for i in range(0, len(word), 1) # prints 0 for i
  </code></pre>
  
  <p>Anyone got an idea?</p>