1
Lesson 1 of 20 ยท Debugging
Debugging โ Part 1
Find and fix mistakes in your program. This is part 1 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!
๐จ๏ธView in Shop
Checkout complete lesson on Debugging for 3rd Grade
Get the full Debugging track as a printable PDF โ all lessons, worksheets, and answer keys.
