title: Python Pi approximation
body: <p>So I have to approximate Pi with following way: 4*(1-1/3+1/5-1/7+1/9-...). Also it should be based on number of iterations. So the function should look like this:</p>
  
  <pre><code>&gt;&gt;&gt; piApprox(1)
  4.0
  &gt;&gt;&gt; piApprox(10)
  3.04183961893
  &gt;&gt;&gt; piApprox(300)
  3.13825932952
  </code></pre>
  
  <p>But it works like this:</p>
  
  <pre><code>&gt;&gt;&gt; piApprox(1)
  4.0
  &gt;&gt;&gt; piApprox(10)
  2.8571428571428577
  &gt;&gt;&gt; piApprox(300)
  2.673322240709928
  </code></pre>
  
  <p>What am I doing wrong? Here is the code:</p>
  
  <pre><code>def piApprox(num):
      pi=4.0
      k=1.0
      est=1.0
      while 1&lt;num:
          k+=2
          est=est-(1/k)+1/(k+2)
          num=num-1
  
      return pi*est
  </code></pre>