title: Python Count paragraph
body: <p>Hello all so i've been tasked to count lines and paragraphs. Counting every line is obviously easy but im stuck on counting the paragraphs. If a paragraph has no character it will give back the number zero and for every paragraph is an increment higher. For example an input file is: <a href="https://www.dropbox.com/s/ccqmsuqc85jtqp7/essay1.txt?dl=0" rel="nofollow">Input</a> and an Output should come out <a href="https://www.dropbox.com/s/scj6zwxwmml489m/problem2.txt?dl=0" rel="nofollow">Output</a>
  so my code is:</p>
  
  <pre><code>def insert_line_para_nums(infile, outfile):
      f = open(infile, 'r')
      out = open(outfile, 'w')
      linecount = 0
          for i in f:
              paragraphcount = 0
              if '\n' in i:
                  linecount += 1
              if len(i) &lt; 2: paragraphcount *= 0
              elif len(i) &gt; 2: paragraphcount = paragraphcount + 1
              out.write('%-4d %4d %s' % (paragraphcount, linecount, i))
      f.close()
      out.close()
  </code></pre>