You've learned the accumulator pattern: a variable that starts at 0 and grows inside a loop. Here you'll use it twice on the same list — once to add things up, once to count them.
A class has a list of test scores. You'll calculate the total of all scores and count how many are passing (70 or above).
Your tasks
Given this starting value:
scores = [88, 92, 75, 60, 100]
1. Create a variable total starting at 0. Loop over scores and add each score to total
2. Create a variable passing starting at 0. In the same loop, add 1 to passing for every score that is 70 or above
3. Print total, then print passing — each on its own line
The five scores add up to 415, and four of them (88, 92, 75, 100) are 70 or above.
Expected output
Constraints
- Start both
total and passing at 0 before the loop
- Use a
for loop to go through scores — do not add the numbers by hand
- Use an
if statement to decide when to count a score as passing (score >= 70)
- Do not change the
scores list