Step 1 of 6

Step 1 · Read and run

Adding up

A running total has three parts:

  1. Before the loop, make the total and set it to 0.
  2. Inside the loop, add to it: total = total + number.
  3. After the loop, print it.

This adds up 1 to 10. Press Step through to watch total grow: 1, 3, 6, 10, …

Run the program to carry on.
total.py

Output

Press Run to see what your program prints.