Unit 8 ·

Reading and fixing code

Read this first. Every question after it comes from these cards.

Learn · 1/3

Report bugs with context

"It doesn't work" is the slowest way to get a fix.

'It doesn't work' gives the AI nothing. A good bug report does better. Say what you did, what happened, the exact error text (with file and line), what you expected, and paste the relevant file.

The exact message holds clues a paraphrase loses.

Bug report

Clicking 'Add' does nothing. Console: 'TypeError: items is undefined' in TodoList.tsx line 12. Expected: the item appears.

The whole lesson as text

Cards and key takeaways

Test what it wrote, debug with context.

Key takeaways

  • What you did, what happened, exact error, what you expected.
  • Retest with the same steps; after two failed fixes, roll back.
  • Explain the code back in your own words.

Report bugs with context

"It doesn't work" is the slowest way to get a fix.

'It doesn't work' gives the AI nothing. A good bug report does better. Say what you did, what happened, the exact error text (with file and line), what you expected, and paste the relevant file.

The exact message holds clues a paraphrase loses.

Bug report

Clicking 'Add' does nothing. Console: 'TypeError: items is undefined' in TodoList.tsx line 12. Expected: the item appears.

Remember: What you did, what happened, exact error, what you expected.

'Fixed' is a claim

The AI says it's fixed. Is it?

When the AI says it fixed something, run it and repeat the exact steps that failed.

The debugging order: reproduce the problem, capture the error and what you expected, give it all to the AI, retest with the same steps.

If the same fix fails twice, go back to the last working version instead of asking again.

Remember: Retest with the same steps; after two failed fixes, roll back.

Check you understand it

If you can't explain it, you can't judge it.

Ask the AI to explain each part of the code, then explain it back in your own words.

Where you can't, you can't judge if it's right.

Remember: Explain the code back in your own words.

Try it now

Paste this into any AI assistant (ChatGPT, Claude, Gemini, Copilot). Fill in the parts in square brackets.

Explain this code line by line for a beginner, then point out one bug or unhandled edge case: [paste a short snippet]

What to check in the answer: Try the case it names (empty input, zero, a negative number) to see whether the bug is real.

Want to go deeper?

This unit continues in a full course: Data Analysis & Decision-Making with Python (NumPy, Pandas). One of its lessons is free to try: “NumPy arrays and operations”.