Write one piece with AI
Ask for a small function and check its answers.
The idea
Give an AI coding tool one clear task at a time.
Tell it the input, the output, and a few examples. Then run the code and compare its answers with yours.
A small example
You could ask:
Write a function that accepts a list of prices. Return the average of the last three prices. Return null if there are fewer than three. Do not connect to a network or place orders.
Prepare these checks before looking at its answer:
| Input | Expected output |
|---|---|
| 10, 11, 12 | 11 |
| 10, 11 | null |
| 9, 10, 11, 12 | 11 |
Try it
Run the function on all three inputs. In the final row, check that it uses only the last three prices.
Check your work
The outputs should match the table. Ask the tool to explain any part you cannot follow.
Code that runs is not automatically correct. Small examples make its behavior easier to inspect.