title: Return First Letter of Line in File
body: <p>I am trying to pull the first letter of every line in a file, then print those letters to a new file. I am working step-by-step so I created the code that would be able to pull the first letter of every line, however, when I added the code to read a specific file it appears that it is not properly iterating over the entire files content. Does anyone know why my for loop is not iterating? Or perhaps, is the issue that it is iterating but not properly adding the letters to 'lines'.</p>
  
  <pre><code>def secret2(m):
      infile = open(m, 'r')
      text = infile.read()
      for line in text:
          lines = text[0]
          for i in range(len(text)):
              if text[i] == '\n':
                  lines += text[i+1]
              print(lines)
              return(lines)
          m.close()
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>&gt;&gt;&gt; secret2('file.txt')
  A
  'A'
  &gt;&gt;&gt; 
  </code></pre>
  
  <p>Proper output would be:</p>
  
  <pre><code>&gt;&gt;&gt; secret2('file.txt')
  'ALICE'
  &gt;&gt;&gt;
  </code></pre>