title: Compact Python for() Loop
body: <p>How do I rearrange the following code into a simplified list comprehension?</p>
  
  <pre><code>for i in xrange(len(list)):
      if list[i].startswith('c'):
          list[i] = prefix + list[i]
  </code></pre>
  
  <p>I tried the following but it did not seem to work:</p>
  
  <pre><code>[prefix + list[i] for i in xrange(len(list)) if list[i].startswith('c')]
  </code></pre>
  
  <p>The following throws me off:</p>
  
  <pre><code>list[i] = prefix + list[i]
  </code></pre>