Skip to content
Start free

How do you ask an AI for a number you can check?

Write a question that spells out the decisions and asks for the counts at each step, then check that receipt against the file.

Free course. Your Maestro, an AI, .

In modules 2 to 4 you checked numbers after they arrived. Every time, the problem was a decision the assistant made for you: counting rows instead of tickets, dividing by 45 instead of 112, leaving out a ticket with no branch, summing duplicate rows. This page flips that around: you make those decisions yourself, in the question, and you ask the assistant to hand you what you need to check its work.

A question you can check isn't just a longer question. It has three parts:

  • It says what a row is. If you know, don't make it guess.
  • It states the decisions. What counts as a sale, what gets filtered out, what to do with empty cells and duplicate rows. If you don't know what to decide, ask it to ask you before it calculates.
  • It asks for a receipt. How many rows it read, how many it removed and why, how many it used, and the code. With those counts, checking means verifying numbers instead of guessing at decisions.

Here is how to build one, step by step:

  1. Say what a row is

    "Each row is a product within a ticket; the ticket column identifies the sale."

  2. Say what you count and what you divide by

    "Each distinct ticket counts as a sale. The average ticket is the total divided by the number of tickets."

  3. Say what gets left out

    "Use only the paid rows. Remove identical rows and tell me how many there were."

  4. Ask about empty cells

    "Tell me how many empty cells there are in the columns you use and what you did with them."

  5. Ask for the receipt

    "At the end, tell me how many rows you read, how many you removed and why, how many you used, and show me the code."

pregunta-revisable.txt
I'm giving you the March sales file for the hardware store. Each row is a
product within a ticket; the ticket column identifies the sale.

I want the total sold and the average ticket for March.
- Count each distinct ticket as a sale, not each row.
- The average ticket is the total divided by the number of tickets.
- Use only the rows with estado "pagado".
- Before calculating, tell me how many identical rows there are and remove them.
- Tell me how many empty cells there are in the columns you use and what you did with them.

At the end, tell me: how many rows you read, how many you removed and why,
how many you used and from how many tickets, and show me the code.
A template to copy. Swap in the columns and decisions from your own table.

The receipt

Imagine you send that question to your assistant and it answers like this (it's an example, not the answer of any particular assistant):

I read 312 rows. I found 7 identical rows and removed them. I left out 27 rows with estado "cancelado", from 11 tickets. I used 279 rows from 112 paid tickets. There are 3 empty cells in sucursal; since I didn't group by branch, those rows are in the total. Total sold: $107,630. Average ticket: $960.98.

Compare this answer with the one from module 1: "312 sales, average ticket of $378.83." That one forced you to guess what it had done. This one gives you seven figures you can check one by one against the file, and if they all hold up, you know it calculated what you asked for.

Notice that the figures all agree with each other except one. If it read 312 rows and removed 7 duplicates and 27 canceled rows, 278 should be left, not 279. Something in the receipt is off, and without the receipt you would never have noticed. Why don't the receipt's figures add up?

From a vague question to one you can check

Worked example · 4 steps

Your boss wants to know "which branch has the most cancellations." In module 3 you saw that this question has three answers. Rewrite it so the assistant doesn't have to guess. Try each step before opening it.

Work out the next step yourself, then open it to compare.

Try it

Check the example receipt figure by figure. The code starts with the first one; you write the rest with pieces you already used in module 4. Run it with Run after each new line, to see one figure at a time.

Check the example receipt: rows read, identical rows, canceled rows and tickets, rows and tickets used, total, and average ticket. You are done when you find which of the receipt's figures doesn't come from the file.

Check the example receipt: rows read, identical rows, canceled rows and tickets, rows and tickets used, total, and average ticket. You are done when you find which of the receipt's figures doesn't come from the file.

Run your code to see what it prints and the value of its last expression. Every run starts fresh.

Ready to run your code.

Run your code to see its output here.

Data: ventas-marzo, 312 rows

Enter saves a cell and Escape leaves it as it was. Leave a cell empty for a missing value.

The exercise's data, "ventas-marzo". Your edits run with your code.
RowRemove
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Page 1 of 16

Run it yourself

There are 6 identical rows, not 7. Everything else matches the file: 312 − 6 − 27 = 279 rows used, and the total and the average come from those 279. The calculation is right; the sentence that sums it up is not. That is the fourth step on the page What does an AI do with your file before it gives you a number?: the summary in words may not say the same thing as the code. If the error had been in the code, the total would have changed, and the receipt would have shown you that too.

It's tempting to end every question with "check your work" and take the number at face value if the AI says it checked. That only asks it to look again at its own decisions, the same ones it didn't tell you about. The receipt, on the other hand, lets you do the checking yourself, with figures you can verify. Help me write a checkable question for a table from my work.

Check yourself: You need the percentage of satisfied customers from a survey that many people didn't answer. Which of these questions gives you an answer you can best check?