SECTION 04 / 15

Find the range, then assign grade bands

2 min read
On this page 2 headings

Instead of dividing the class into above and below average, we can create four grade bands. First discover the lowest and highest actual Mathematics marks. Only then can we set fixed bands and classify students.

The observed integer scores run from 42 to 97. The four equal-width bands contain different numbers of students.
The observed integer scores run from 42 to 97. The four equal-width bands contain different numbers of students.
REAL COURSE DATA · FOLLOW THE PROCEDURE

Find the range, then assign grades

Read the current record, check the explanation, and watch the variables. Use Back to revisit any step.

Ready

CURRENT RECORD

Ready to begin

No records have been processed. Start with Next step.

What we remember

Processed
0

Start at the first step. Watch the current row and the values we remember.

Update minimum and maximum independently

Minimum = 101
Maximum = -1
for each row X in Scores {
    if (X.Mathematics < Minimum) { Minimum = X.Mathematics }
    if (X.Mathematics > Maximum) { Maximum = X.Mathematics }
}

These initial values work because valid marks lie from 0 to 100. The first value, 68, updates both variables. Use two separate if statements, not if / else. Starting both variables from the first real row is another safe approach for a nonempty dataset.

Count integer values, including both ends

Maximum − Minimum = 97 − 42 = 55 is the numerical difference. There are 97 − 42 + 1 = 56 possible integer marks when both ends are included. Four equal groups of 14 integer values give the following bands.

GradeInclusive Mathematics bandActual students
D42–553
C56–699
B70–8310
A84–978
for each row X in Scores {
    if (X.Mathematics >= 84) { Grade = "A" }
    else if (X.Mathematics >= 70) { Grade = "B" }
    else if (X.Mathematics >= 56) { Grade = "C" }
    else { Grade = "D" }
    record (X.CardNo, Grade)
}

These are the lecture’s example bands, not an official grading policy. Equal-width intervals do not promise equal student counts. Boundary choices must be explicit; a new dataset may require different bands. If min equals max, handle that separately rather than pretending there is a spread.

Try it yourself

Why does the inclusive count use +1?

Show explained answer

42 and 97 are both included. The difference counts gaps; +1 counts the integer values.

Try it yourself

Where do 55,56,69,70,83,84 go?

Show explained answer

55→D; 56 and 69→C; 70 and 83→B; 84→A.

Try it yourself

Why can the first mark update both min and max?

Show explained answer

Before seeing any marks, both limits are placeholders. The first real mark is both the smallest and largest seen so far.

Try it yourself

Does each band have 7 or 8 students?

Show explained answer

No. The actual counts are A 8, B 10, C 9 and D 3.

Try it yourself

Can Minimum start at zero for valid nonnegative marks?

Show explained answer

That would stop it updating when every mark is positive. Use a sufficiently high bound or the first real value.

YOUR STUDY PROGRESS

Finished this section? Save your progress.

Back to top ↑