Learn

Now that we have a function to print the grades, let’s create another function to compute the sum of all of the test grades.

This will be super-helpful when we need to compute the average score.

I know what you’re thinking, “let’s just use the built-in `sum` function!” The built-in function would work beautifully, but it would be too easy.

Computing the sum manually involves computing a rolling sum. As you loop through the list, add the current grade to a variable that keeps track of the total, let’s call that variable `total`.

### Instructions

1.

On line 3, define a function, `grades_sum`, that does the following:

• Takes in a list of scores, `scores`
• Computes the sum of the scores
• Returns the computed sum.

Call the newly created `grades_sum` function with the list of `grades` and `print` the result.

# Take this course for free

By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

## Or sign up using:

Already have an account?