Quirk in calculating a percentage with a while loop
<p>I am trying to do a quick percentage counter, as follow:</p>

<pre><code>percentage = 1
while chunk:
    chunk = f.read(size/100)
    read += len(chunk)
    m.update(chunk)
    if size &gt; 500000000:
        print '%s done for %s.'%(percentage, name)
        percentage += 1
</code></pre>

<p>This returns 102 print statements, [1,102], instead of what I am trying to do, [1,100]. The reason for this seems to be that it is doing a print statement on the first iteration (0 read) and also on the last iteration (100% read). What would be the simplest way to fix this?</p>
