Quarry School

Group a calculation — quick review

In plain words

Four supply kits sit on a table.

Rule

When parentheses group an addition, do the addition inside them before multiplying by the number outside. In a calculation with addition and multiplication and no grouping parentheses, Python does the multiplication first.

Step

  1. Write 6 + 3 to count the pieces for one kit.

  2. Put parentheses around that addition to get (6 + 3).

  3. Put * 4 after the group to count four kits.

Trap

Reading 6 + 3 * 4 strictly from left to right would give 36. Python does 3 * 4 first, which counts 12 rings, then adds six clips once, for 18 pieces. To count six clips in every kit, group the two counts as (6 + 3) * 4.