BYTE'S AI LAB Lesson 9 of 12
Station 9 · Repair Shop

Fixing Things: Debugging with AI

Every coder hits bugs — even the pros. Today you'll learn to spot them, describe them, and fix them.

Try it first

Bug Hunt

Below are 5 tiny broken code examples (illustrative, not a live tool). For each one, guess what's wrong before checking the answer.

Notice that most bugs are small — a mismatched tag, a missing mark, or code that doesn't match what it's supposed to do. Spotting them gets easier with practice.

The idea

So what's a "bug"?

A bug is a small mistake in code that makes it not do what you wanted. Bugs are a completely normal part of coding — even professional programmers create them constantly. Finding one isn't a sign you did something wrong; it's just part of the process.

Two habits make fixing bugs go much smoother. First, describe the problem clearly to your AI tool: what you expected to happen, and what actually happened instead — the same specific thinking you used for prompts back in Lesson 4. Second, after AI gives you a fix, test it to make sure it actually works, and try to understand why it worked instead of just copying it in.

Byte says

Debugging is often a few rounds, not just one try. If a fix doesn't quite work, that's normal too — just describe what's different now and try again.

Now try it for real

Fix It Yourself

This activity happens in your own code generation tool — not on this page.

Want to plan your bug report first? Draft it here.

Saved right in this browser, on this device — it's just for planning, and never sent anywhere.

Ask a grown-up

Just like in Lesson 8, running or testing any code — fixed or not — should always be done with a grown-up present.

  1. 1Open your code generation tool with a grown-up nearby — you can revisit your project from Lesson 8, or start a new small one.
  2. 2Find or create a small bug. The easiest way: go back to your Lesson 8 project and delete one bracket or quotation mark on purpose. (You can also ask your AI tool for a broken example, but a small change you make yourself is easier to explain.)
  3. 3Describe the problem clearly: what you expected to happen, and what actually happened instead.
  4. 4Read the fix it suggests before using it. Does it make sense? Can you explain why it works?
  5. 5Run the fixed code with your grown-up and test that it now works the way you expected.
  6. 6If it's still not quite right, describe what's different now and try again — that's normal.
Your turn

What was the bug?

Think about the Bug Hunt game or your own fix — what was the bug, and how did you (or would you) describe it to get a useful fix?

This is saved right in this browser, on this device — it's never sent anywhere.

Recap

What you just learned

Show what you know

Quick Quiz

10 questions, picked at random from a bigger question bank — so if you take it again, you'll likely see a different mix. Let's go!

Up next

Lesson 10 · Staying Safe and Being a Good AI User

Privacy, spotting fakes, and using AI honestly.

Go to Lesson 10 →