looping over product to compute a serie in python
<p>I'm just gonna compute the result of below serie in python:</p>

<p>The formula</p>

<p><a href="http://i.stack.imgur.com/vxNE0.gif" rel="nofollow"><img src="http://i.stack.imgur.com/vxNE0.gif" alt="enter image description here"></a></p>

<p>So, here is my function to compute:</p>

<pre><code> def compute(limit):
     pi = 1
     for i in range(1,limit):
         pi = pi * ((4*(i**2))//(4*(i**2)-1))
     print(2*pi)

 compute(10000) /*returns 2*/
</code></pre>

<p>I know it is a silly question. But could you address the problem with this snippet?</p>

<p>You have <code>//</code> and not <code>/</code>, you wanted division, but made floor division</p>

<pre><code>def compute(limit):
    pi = 1
    for i in range(1,limit):
        pi = pi * ((4*(i**2))/(4*(i**2)-1))  # you had here //
    print(2*pi)

compute(10000)
</code></pre>

<p>Output:</p>

<pre><code>3.1415141108281714
</code></pre>

python