PR3_Studienleistung_1_Prof_.../s1_a4.py

18 lines
345 B
Python
Raw Permalink Normal View History

2022-11-09 10:21:49 +01:00
import math
def reziprok(x):
check = True
summe = 0
i = 1
while(check):
summe+= 1/(i*i)
i += 1
if(round(summe,6) == x):
check = False
print(f"Number of runs: {i}" )
print(f"π^2/6: {x}")
2022-11-09 09:36:51 +01:00
if __name__ == '__main__':
2022-11-09 10:21:49 +01:00
x = (math.pi*math.pi)/6
reziprok(round(x,6))