PR3_Skriptsprachen_GruppeD_SL1/s1_a4.py

10 lines
417 B
Python
Raw Normal View History

2022-11-05 15:33:32 +01:00
import math
if __name__ == "__main__":
row_value = round(math.pi**2/6, 6) # = 1.644934
sum_of_reciprocal_squares = 0
divider = 1
while row_value != round(sum_of_reciprocal_squares, 6):
sum_of_reciprocal_squares += 1/divider**2
divider += 1
print("After adding the first " + str(divider-1) + " reciprocal square numbers the sum equals " + str(round(sum_of_reciprocal_squares, 6)))