Slow pi approximation X27663


Statement
 

pdf   zip

html

Write a function slow_pi_approx(n) that given a non negative integer n computes 4∑k = 0n (−1)k/2k + 1 The returned value has to be rounded to the ten thousandth by using the python function round(_,4).

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