Informatique

Question

Bonjour, j'ai un exercice python à faire, et je n'y arrives pas, pouvez-vous m'aidez svp ?​
Bonjour, j'ai un exercice python à faire, et je n'y arrives pas, pouvez-vous m'aidez svp ?​

1 Réponse

  • Réponse :

    Explications :

    1) 1er m : 100

      2eme : 140

      3eme : 180

    total : 100 + 140 + 180 = 420

    Programme

    def puits(H):

       M=100

       S=100

       N=1

       while N<H:

           M=M+40

           S=S+M

           N=N+1

       return(S)

    Console résultats

    >>> puits(8)

    1920

    >>> puits(10)

    2800

    >>> puits(3)

    420

    >>>

    Donc pour 8m prix total 1920€

    Et  pour 10m prix total 2800€

    3)

    Programme

    def profondeurmax():

       M=100

       S=100

       N=0

       while S<4000:

           M=M+40

           S=S+M

           N=N+1

       return(N)

    Console

    >>> profondeurmax()

    12

    >>>

    Profondeur maximale: 12m

    Remarque Prix pour 12 m 3840 €

                             pour 13m 4420 €