pr3-skriptspr-gruppef-sl1/s1_a4.py

16 lines
278 B
Python

#4.1
import math
z = ((math.pi**2)/6)
x = "%(z).6f"%{'z':(math.pi**2)/6}
y = 1.644934
print(x)
i = 1
sum = 0
while sum < y:
sum = sum + (1 / (i ** 2))
i = i + 1
print("Summe:", sum, ", Schritte: ", i) #Summe: 1.6449340000000012, Schritte: 14959887