Skip to content

A new table: workshop registrations

Check an AI's count of people on a table you have not seen, with different columns and less help.

2 parts · 6 and 4 min

Free course. Your Maestro, an AI, .

A training team asked an AI assistant a straightforward question about their upcoming workshops: "How many people have at least one active registration?" The assistant answered 7 and showed the two lines of code it ran to get that number.

Up to now, you have worked with the eight rows of the shop orders table, and each page guided you through one step at a time. Here you meet a table you have not seen before, with 10 rows and four columns: signup, person_email, session, and registration_state. The column names are different, and the AI's filter uses != (not equal to) rather than ==.

This page leaves out the worked examples, the code comments, and the expected answer on purpose. When someone hands you an AI's count at work, you only have the table, the question, and the code. To check the AI's answer of 7 and replace it with a number you can trust, complete four parts in order:

  1. State the grain of the table

    Print data in the exercise below and inspect all four columns (signup, person_email, session, and registration_state). Write one sentence saying what a single row stands for, and note whether the same person can appear on several rows.

  2. Read the AI's code line by line

    Explain in plain English what data["registration_state"] != "cancelled" keeps and drops, and state what len(active) actually counts on the filtered table.

  3. Repair the count to match the question

    Add code that counts what the question asks for, as it is worded.

  4. Check your repaired number a second way

    Verify your count independently: print the sorted list of unique person_email values from active, or list the qualifying emails by hand from the printed table, and confirm that the list and your count agree.

Because this page tests whether you can run the whole check on your own, help works differently here. Your Maestro will hold back on hints until you have posted your own attempt at the sentence and a repaired count. Asking your Maestro for a hint is always fine, and once you have tried on your own, your Maestro will coach you through whatever is blocking you. Just know how it is recorded: completing the four parts unaided counts as independent evidence of the skill, while finishing with hints from your Maestro counts as help-assisted practice.

Try it

Start in the code box below. Add print(data) at the top to see all 10 rows, then add your repaired count and your second check beneath the AI's lines. If you have tried a repair and your count still disagrees with your list of emails, send your attempt to your Maestro.

Your turn

The AI's code is below. Print the table, decide what one row is, repair the count so it answers the question, and add an independent check of your number. You're done when your count and your check agree.

Data: workshop-registrations, 10 rows
The exercise's data, "workshop-registrations". Your edits run with your code.
RowRemove
1
2
3
4
5
6
7
8
9
10

A good place to stop. Up next: part 2 of 2 · 4 min

Once your repaired count and your second check agree in the output above, write down your grain sentence and your line-by-line reading in the check below. When all four parts are ready, you can also share your code and output with your Maestro.

Check yourself: In your own words: (1) Write one sentence stating what a single row of the registrations table stands for. (2) Explain line by line what the AI's two lines of code do and why the AI's answer of 7 does not answer "How many people have at least one active registration?" Include the repaired number your code produced and how you checked it.

Check yourself: In your own words: (1) Write one sentence stating what a single row of the registrations table stands for. (2) Explain line by line what the AI's two lines of code do and why the AI's answer of 7 does not answer "How many people have at least one active registration?" Include the repaired number your code produced and how you checked it.

Ctrl+Enter or ⌘+Enter sends it.

Answer it yourself

Reflect: Looking back at the shop orders table and this workshop registrations table, what carried over directly from the way you checked the orders count, and what was different this time that you had to watch out for?

Reflect: Looking back at the shop orders table and this workshop registrations table, what carried over directly from the way you checked the orders count, and what was different this time that you had to watch out for?

Only you and your Maestro read this. It's kept on your account and deleted with it.

Write your answer

Only you and your Maestro read this. It's kept on your account and deleted with it.

The reading ends here; your Maestro carries on.