18 lines
281 B
Python
18 lines
281 B
Python
|
from cmath import pi
|
||
|
|
||
|
END_CONDITION = (pi**2)/6
|
||
|
sum = 0
|
||
|
i = 1
|
||
|
counter = 0
|
||
|
|
||
|
while(True):
|
||
|
sum = sum + (1/(i**2))
|
||
|
if('%.6f'%sum == '%.6f'%END_CONDITION):
|
||
|
print('%.6f'%sum)
|
||
|
break
|
||
|
i = i+1
|
||
|
counter = counter +1
|
||
|
|
||
|
print('Anzahl der Iterationen: ', counter)
|
||
|
|