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