Slow pi approximation X27663


Statement
 

pdf   zip

Write a function @slow_pi_approx(n)@ that given a non negative integer nn computes 4k=0n(1)k2k+14\sum_{k = 0}^n \frac{(-1)^k}{2k + 1} The returned value has to be rounded to the ten thousandth by using the python function round(_,4).

Sample session

Sample session
>>> slow_pi_approx(10)
3.2323
>>> slow_pi_approx(100)
3.1515
>>> slow_pi_approx(1000)
3.1426
Information
Author
ProAl
Language
English
Official solutions
Python
User solutions
Python