STEP 6: Now let's start the looping through the list to find the sum of all the values!

We'll use the symbol += to add to the existing value of the variable.

  • In LOGIC, click on . Drag out Loop through List. Change the name of the list to my_data.
  • Click on . Drag Add Value INSIDE your loop. Change the variable name to total.
  • Change the number 1 to the variable value so the line looks like this: ····total·+=·value

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)