STEP 9: We have the sum, now let's get the number of grades. We'll get the length of the list to find that!

Using len() returns the length of a list. This tells us how many items are in the list.

  • In LOGIC, go to and drag Get Length of List into the bottom of print_average().
  • Change my_var to num_grades and my_list to list_of_grades.
  • Go to and drag out Division. Change the equation to average·=·total·/·num_grades

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)