12
Lesson 12 of 20 · Finding Mistakes
Finding Mistakes — Part 2
Find and fix mistakes in your program. This is part 2 of 20.
What you'll learn
You will learn to read code carefully to find mistakes (bugs) and understand how to fix them.
Steps
- 1Read the code line by line: x is 2, y is 3, z is x + y which is 5. The output would be 'Total: 5'. This code is correct!
- 2Now imagine the last line was print('Total:', x) by mistake. It would show 'Total: 2' — wrong! That's a bug.
- 3Debugging means reading code carefully, finding where it goes wrong, and fixing it. It's like being a detective!
- 4Every coder — even experts — writes bugs. The skill isn't avoiding bugs, it's being good at finding and fixing them!
Key Terms
- Bug
- A mistake in the code that makes the program do something wrong or unexpected.
- Debug
- To find and fix bugs. You look at the code and the output to figure out what's wrong.
- Fix
- To change the code so it works correctly. Fixing bugs is part of coding.
Python 3
Output
Loading Python... This may take a few seconds.
Your code runs only in your browser. No code is sent to any server. Stay safe and have fun learning!
Ready?
Finding Mistakes — Part 2
You will learn to read code carefully to find mistakes (bugs) and understand how to fix them.
Full screen — no distractions
🖨️View in Shop
Checkout complete lesson on Finding Mistakes for 1st Grade
Get the full Finding Mistakes track as a printable PDF — all lessons, worksheets, and answer keys.
