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