Grade 3 · lesson 3 of 4

Count Items That Match a Rule

Combine a repeat over cards with a conditional count.

Download the grade pack

Supplied materials

  • Paper and pencil; an adult may read aloud. No device, account or purchase is needed.

Learn the idea

We can use a condition inside a repeat. The repeat visits each card once, and the condition decides whether that visit adds to a count. Start the count before visiting cards. A card that fails the condition still gets visited, but it does not add to the matching count.

Supplied list in order: star, circle, star, triangle, star. Algorithm: set matches to 0; for each card, if its shape is star, add 1 to matches; after all cards, show matches. A trace records the count after each card. Keep the count from the previous row.

  1. Write the five-card list and start a matches column at 0.
  2. For each card, answer is it a star?
  3. Add 1 only on true rows and carry the old count on false rows.
  4. Read the final count and compare it with a direct count of stars.
Worked example

See the method in action

Counts after the five cards are 1, 1, 2, 2, 3. The final result is 3 matching cards, even though 5 cards were visited.

Your turn

Check your reasoning

Your answer is temporary and is not saved to an account. Download your current answer before leaving or reloading. Written work on paper or in another app stays in your own file.

Trace circle, star, star, circle under the same algorithm. What is shown?

Feedback appears here after you check. This is practice, not a graded school assessment.

See the answer and explanation

2

The running counts are 0, 1, 2, 2. Exactly two cards meet the star condition.

Take it further

Change the condition to shape is circle in the original list. Expected trace: 0, 1, 1, 1, 1, so the final result is 1.

Nothing here is saved to an account or sent to a teacher. The answer download includes your current choice and any checked feedback.

Check the subject sources

These LifeStarter passages, scenarios and exercises are authored for this Academy with AI assistance and review. External resources keep their publishers’ terms. A grade label suggests a starting level; it does not establish alignment with your school’s complete requirements.