Course 7, lesson 68 of 100, Ages 10+

AI that writes code

Programming with a helper

Like I’m 5

Code is the set of instructions that makes apps and games work. AI can now help write code, like a helper who knows lots of programming words.

The big idea

Coding assistants learned from huge amounts of public code. Describe what you want, like 'a button that changes colour when clicked', and they suggest code. They can also explain errors and tidy up programs.

They make mistakes, from small bugs to security holes, so programmers read, test and understand the code before using it. Learning the basics yourself helps you spot problems and build what you imagine.

Examples

  • Explaining: 'What does this line of code do?'
  • Fixing: Paste an error message and get suggestions.
  • Testing: Running the code to check it really works.

How it works

  1. Describe clearly what you want the code to do.
  2. Read the suggested code and understand it.
  3. Test it, fix problems, and only then use it.

Check your understanding

What should you do with AI-written code?
Options: Read and test it before using it; Use it without looking; Print it and frame it.
Answer: Read and test it before using it. Testing catches bugs the AI may have introduced.
Why is it still worth learning to code?
Options: So you can understand and check AI's code; Because AI can't type; It isn't worth it.
Answer: So you can understand and check AI's code. Understanding code lets you spot mistakes and build your own ideas.

Remember

AI can write and explain code, but people must read, test and understand it.

Talk about it

What simple app or game would you like to build with an AI helper?

Go deeper

Coding agents can now edit files, run tests and fix failures in loops. Studies show productivity gains, alongside risks such as insecure patterns, so code review and tests stay essential.