4. Accumulators

System Message: WARNING/2 (/home/runner/work/PyZombis/PyZombis/_sources/lectures/TWP15/TWP15_4_en.rst, line 15)

Explicit markup ends without a blank line; unexpected unindent.

   suma = 0    while n <= 10:        x = int (input (“Enter the last %d number: “% n))        suma = suma + x        n = n + 1

   print (“suma: %d”% suma)

System Message: WARNING/2 (/home/runner/work/PyZombis/PyZombis/_sources/lectures/TWP15/TWP15_4_en.rst, line 28)

Explicit markup ends without a blank line; unexpected unindent.

   :nocodelens:    :stdin:

   n = 0    suma = 0    while n <10:        x = int (input (“Enter the last %d number: “% (n + 1)))        suma = suma + x        n = n + 1

   print (“Average: %5.2f”% (suma / n))

Activity: CodeLens 4.3 (cl_l15_4_en)

   i = 1    fact = 1    while i <= 10:        fact = fact * i        i = i + 1    print (“Fact(10) =% d”% fact)

System Message: WARNING/2 (/home/runner/work/PyZombis/PyZombis/_sources/lectures/TWP15/TWP15_4_en.rst, line 56)

Explicit markup ends without a blank line; unexpected unindent.

   :nocodelens:    :stdin:

   i = 1    fact = 1    n = int (input (“Enter n: “))    while i <= n:        fact = fact * i        i = i + 1

   print (“Fact(%d) =% d”% (n, fact))

You have attempted of activities on this page