Logo Les Interros des Lycées
04-17.py
Programme Python de l'Interros des Lycées 1re M
def fact(n):
    f = 1
    for i in range(1,n+1):
        f *= i
        return f

x,e,d,n = 3,1,1,0

while d>0.0001:
    n += 1
    old_e = e
    e += x**n/fact(n)
    d = abs(old_e-e)

print(n,e,d)