python: while loop does not reach last iteration
<p>I don't get the result of this code:</p>

<pre><code>a = i = 0.05
b = 1.0
while a &lt;= b:
  print a
  a += i
</code></pre>

<p>Of course this should print 0.05,0.1,...,1.0 but instead the iteration stops at 0.95. Is it a float issue?</p>

<p>Perhaps a better answer would be the following:</p>

<pre><code>a = i = 0.05
b = 1.0
a = i = int(a * 1000)
b = int(b * 1000)
while a &lt;= b:
   print a/1000.0
   a += i
</code></pre>

<p>This way you wont need to deal with floating point numbers at all. Many ways to skin a cat.</p>

python while-loop iteration