Coding assistants (built into the editor, used through chat, or run as agents) have become everyday tools for many developers and analysts. Used well, they save a considerable amount of time. Used badly, they produce wrong code that looks right. This course teaches you to get the most out of them without losing control.
How it works, in simplified terms
A coding assistant is built on a large language model (LLM), trained on immense amounts of text and code. From your request, it produces, piece by piece, the most plausible continuation. It does not “understand” your project like a colleague would and, unless it has tools to do so, it does not run the code it suggests: so it doesn’t know whether that code works.
Practical consequences:
- it excels at frequent, well-documented tasks: writing a classic function, explaining an error message, converting code from one language to another, suggesting tests;
- it is less reliable on what is rare, recent or specific to your project: a little-known library, an internal business rule, a very recent version of a tool.
Three forms of assistants
| Form | Typical use |
|---|---|
| Conversation (chat) | ask a question, request an explanation or a function |
| In-editor completion | code suggestions as you type |
| Agent | the tool reads your files, modifies the code, runs commands or tests |
The more autonomous the tool, the more important it is to review what it does.
Context
The model only sees what you give it: your message, the files that are open or shared, the conversation history. This amount is limited (the context window). If it doesn’t know that you are using Python 3.15, pandas or a naming convention, it will guess. And the same question can produce different answers from one time to the next.
Hallucinations
A model can invent things with great confidence: a function that doesn’t exist, an imaginary parameter, a fictitious package name. A typical example:
notes = [12, 15, 9]
moyenne = notes.mean() # suggested by an assistant: AttributeError!
# Python lists have no mean() method.
# Correct: sum(notes) / len(notes), or statistics.mean(notes)
The code “looks like” pandas or NumPy, hence the confusion. How to protect yourself:
- run the code and read the errors;
- check any unfamiliar function in the official documentation;
- be wary when the assistant cites a precise source, version or figure.
The golden rule
The assistant is a fast colleague but not always a reliable one. You remain responsible for the code you integrate:
- only keep code that you understand line by line;
- test it as if you had written it yourself;
- when learning, try on your own first, then compare with the AI’s suggestion: this is how you make progress instead of depending on the tool.
Exercises
Solutions and tests stay on the server. In the student space, your code is run and checked, and the tutor gives hints before the solution.
Fix a hallucination
An assistant suggested this code, which raises an
AttributeErrorbecause Python lists have neither.mean()nor.max_value(). Fixresume(notes)so that it returns a tuple(moyenne, maximum)using tools that actually exist.def resume(notes): moyenne = notes.mean() maximum = notes.max_value() return (moyenne, maximum)Why a hallucination?
Why can a coding assistant suggest a function that doesn’t exist?
- Because it is broken
- Because it generates the most plausible text without checking that it is accurate
- Because the function was removed from Python
A suitable task
For which of these tasks is a coding assistant generally the most reliable?
- Applying an undocumented internal billing rule
- Writing a function that reverses a string
- Using a library released last week
End-of-lesson quiz
By default, does a chat-based coding assistant verify that its code works?
- Yes, always
- No, unless it has tools to run it
- Only in Python
Who is responsible for the code integrated into a project?
- The AI assistant
- The developer who integrates it
- The tool's vendor
What is the context window?
- The editor window
- The amount of information the model takes into account to respond
- The duration of a session
The rest of the course
- Writing a Good Prompt for Code15 min
- Reviewing Generated Code20 min
- Testing and Debugging with AI20 min
- Responsible Use: Security, Data and Learning20 min