8 lines
199 B
Python
8 lines
199 B
Python
|
def approx_pi(var_1):
|
||
|
if var_1 == 0:
|
||
|
print(4)
|
||
|
return 4
|
||
|
var_2 = 0
|
||
|
for var_3 in range(var_1+1) :
|
||
|
var_2 += (((-1)**var_3) / ((2*var_3)+1))
|
||
|
return(4*var_2)
|