---
title: "Ordering rules and checking coverage"
course: "AI101 · AI, explained"
unit: "Building with rules and search"
lesson: 13 of 36
source: https://open.maestrocollege.edu/ai-explained/ordering-rules-and-checking-coverage
publisher: Maestro College
---

# Ordering rules and checking coverage

Lesson 13 of 36 in **AI, explained** (AI101), unit "Building with rules and search". An open lesson from Maestro College.

## What the learner will be able to do
- Build a rule-based classifier that assigns every input exactly one category through ordered rules and a default.
- Resolve conflicts between rules that match the same input by setting an explicit priority order and stating the reason for it.
- Measure a rule-based system's coverage on the build data by counting how many inputs land in each category and how many fall through to the default.

## Teaching notes
STARTING STATE: route() with and, or and not conditions. IN THIS LESSON: the learner finds training tickets that two rules both match, puts route() in an explicit priority order with a comment saying why, then writes a coverage check with collections.Counter that runs route() over the 240 training tickets and prints how many land in each category and how many reach the default (a temporary 'other-default' marker is fine). No accuracy yet, and the test tickets stay untouched. END STATE: a priority-ordered route() and a pasted coverage printout, committed as 'Order router rules and check coverage'.

## Course teaching approach
- Start from a real-world problem, then introduce the concept as the solution.
- Keep it true beginner level, hands-on, a little gamified. The learner should feel they are winning.
- Balance explanation, demonstration and practice. No copy-paste exercises: give small story-based tasks.
- End with one fun closed question about the topic.

## How to use this document
You are acting as a tutor for a learner on Maestro Open. Teach from this document, one small step at a time. Ask the learner to try things, wait for their answer, then give feedback. Keep it beginner-friendly. If the lesson involves code or spreadsheets and you cannot run them, ask the learner to try it on their own computer and paste the result back. Do not award grades, credit or certificates.

## When the lesson is done
The lesson is complete only when the learner has shown they can do every outcome listed above. Check each one with a small task or question; if an answer is wrong, explain and let them try again before moving on.
When every outcome is covered:
1. Say clearly: "Lesson 13 complete: Ordering rules and checking coverage."
2. Give a two-line recap of what they learned.
3. Name the next lesson, "Measuring accuracy on held-out data" (lesson 14 of 36), and give the learner its link: https://open.maestrocollege.edu/ai-explained/measuring-accuracy-on-held-out-data.md. Tell them to paste that page into this chat, or fetch it yourself if you can open links, then start it the same way. Do not start teaching the next lesson's topic until the learner has it.

Previous lesson: Combining conditions with Boolean logic
Next lesson: Measuring accuracy on held-out data
