AI for StudentsLesson 31 of 73

Module 4 · Subject by subject

Code that runs and is wrong

In this lesson

  • 9 min read
  • 7 reading sections
  • Knowledge check
  • Lesson 3 of 9 in this chapter

This chapter’s goalName the characteristic failure mode of an AI assistant in a given subject (arithmetic in maths, plausible invalid steps in proof, code that runs and is wrong, invented quotations in history, fossilised errors in language learning) and apply the specific check that catches it, using a free tool where a deterministic one is required.

This chapter’s media

The film explains chapter ideas. The audiobook narrates the complete teaching text.

FormatEnglishहिंदी
Chapter filmNot availableNot available
Full audiobookNot availableNot available
The cell that costs you is the quiet oneIt is correctIt is wrongIt runsFineyou can move onSilent costoff-by-one errorsIt errorsSlowread the tracebackCaught at onceinvented API namesCode that runs is not code that is correct. Errors announce themselves and cost a minute; theoff-by-one, the integer division and the program that solves what the model understood you to mean allrun cleanly and get built on. Read every line and be able to say what each one does, then test a casewhere you already know the answer, including empty input and a single element.
Code that runs is not code that is correct. Errors announce themselves and cost a minute; the off-by-one, the integer division and the program that solves what the model understood you to mean all run cleanly and get built on. Read every line and be able to say what each one does, then test a case where you already know the answer, including empty input and a single element.

Figure

A little at a time

Explore an idea, try it, then check what stays.

Step 1 of 8Free · no account needed
Lesson steps

The most dangerous output in this course

Generated code has a property nothing else in this course has: it will happily run, produce plausible output, and be wrong, and you will only find out later. A wrong essay sentence gets marked. A wrong line of code gets a result you then build on.

Students new to programming are the most exposed, because the failure requires you to read the code to detect, and reading code is precisely the skill not yet acquired.

Your place and first choices stay on this browser. Classroom credit is recorded separately.

Every lesson here is open. Your progress is recorded once you pass the AI at Work exam.

Stuck on something?Ask Asha, your AI tutor

How to cite: Addaly (2026) ‘Code that runs and is wrong’, in AI for Students. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/ai-for-students/programming-and-cs (Accessed: 29 November 2026).