from math import sqrt def calcul(seuil): n = 1 u = 1 somme = u while n < seuil: n += 1 u = 1/n**2 somme += u return n, u, somme print(calcul(1000000)[2])