7 lines
140 B
Python
7 lines
140 B
Python
|
def approx_pi(i):
|
||
|
sum=0
|
||
|
for x in range (0,i+1):
|
||
|
sum+=((-1)**i)/((2*i)+1)
|
||
|
sum=4*sum
|
||
|
print(sum)
|
||
|
return sum
|