Step 3 – Enter the test scores
Next we need to enter the test scores and add them up as we go.
We'll use a loop for this, but this time it will be a for loop.

- Start by setting up a variable called total with the value 0: total = 0
- Next start the for loop. This looks a bit odd, but it works: for i in range(0, tests)
What this is doing is saying "I want to do the next bit of code as many times as there are tests". It uses a range from 0 to the number of tests to do this. It's a bit tricky, but it does work
- Then enter the nextScore and convert it to an integer at the same time
- Then add this to the total using total = total + nextScore
This updates total each time
- Run your program
The program will run and you should be able to enter everything, but we haven't calculated the average yet.
THEORY: You use a for loop when you know how many times you want to do the bit of code. It's a different type of repetition to a while loop which keeps doing the code until something is True