WeCodeAcademy

Checking AI Output

Treat AI output as a draft from a fast but sometimes careless assistant. Before you rely on it:

  1. Check facts that matter (names, numbers, dates, sources). Models can invent convincing references.
  2. Run and test code it writes. It may look right and still fail.
  3. Ask for reasoning and spot-check the steps.
  4. Compare with a trusted source or a second method.

For code, the safest habit is to write a few tests first. Here a function that "looks right" fails a test, and the test catches it.

Examplepython
Open in editor »
Quick check

What is the safest way to trust code written by an AI assistant?

Your turn: write the code

Fix the function so that all the tests pass, then print how many tests pass.

Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.

Tip: use the left and right arrow keys to move between lessons.