9 lines
154 B
Python
9 lines
154 B
Python
|
def approx_pi(i):
|
||
|
n = 0
|
||
|
pi = 0
|
||
|
if n <= i :
|
||
|
j = ((-1)**n)/((2*n) +1)
|
||
|
pi += 4*j
|
||
|
n+=1
|
||
|
return pi
|
||
|
print(pi)
|