Mathématiques

Question

Bonsoir, je bloque sur cette ex de python pouvez vous m'aider svp
Bonsoir, je bloque sur cette ex de python pouvez vous m'aider svp

1 Réponse

  • Réponse :

    bjr, n hesites pas si tu as des questions

    attention a l indentation dans python, il faut 4 espaces, pas de tabulation

    Explications étape par étape

    w0=2

    wn+1 = wn + 1/(1+n)

    A, U et S sont des reels; i et N sont des entiers

    saisir N

    U <- 2

    S <- 2

    pour i variant de 0 a N

       U <- U + 1 / ( 1 + i)

       S <- S + U

    fin pour

    afficher U

    afficher S

    N = int(input("Veuillez saisir N   :  "))

    U = 2

    S = 2

    for i in range(N):

       U = U + 1 / ( 1 + i)

       S = S + U

    print("U : ",U)

    print("S : ",S)