Lesson 13 of 13

DEBUGGING:
Hunt the Bugs! ๐Ÿ›

Every coder makes mistakes โ€” even the pros! Debugging means finding and fixing those mistakes. Think of yourself as a code detective! ๐Ÿ”

debug_mode.py
โŒ Error: name ‘pritn’ is not defined
print(“Hello!”) # โ† typo fixed!
โœ… Output: Hello!
๐Ÿค” What is Debugging?

You’re a Code Detective!

Finding and fixing mistakes in code โ€” step by step, just like solving a mystery!

When I first started coding, my code crashed and I had no idea why. I panicked! Then my teacher said โ€” “Relax. Every single programmer faces bugs. Even the people who built Instagram debug their code every day.” That made me feel so much better. Bugs are normal. Fixing them is the skill! ๐Ÿ•ต๏ธ

๐Ÿ›
The Bug
Something in your code isn’t working as expected
๐Ÿ”
Find It
Read the error message and look at the code carefully
๐Ÿ”ง
Fix It
Change the mistake and run the code again!

๐Ÿ› Types of Bugs

4 Bugs Every Kid Coder Meets!

I’ve made all of these โ€” so you know exactly what to look for!

โœ๏ธ

Typo Bug โ€” Spelling Mistake!

Most Common

You spell a word wrong โ€” like pritn instead of print. The computer can’t understand it and crashes!

โŒ Bugpritn(“Hello!”)
โœ… Fixedprint(“Hello!”)
๐Ÿ”ค

Missing Quotes โ€” Forgot ” ” !

Very Common

Forgot quotes around your text? The computer thinks it’s a variable name โ€” and crashes because it can’t find it!

โŒ Bugname = Sara
โœ… Fixedname = “Sara”
๐Ÿ“

Wrong Indentation โ€” Bad Spacing!

Python Specific

In Python, spaces matter! Code inside a loop or if/else must be indented โ€” 4 spaces โ€” or Python gets confused!

โŒ Bugif True:
print(“Hi”)
โœ… Fixedif True:
    print(“Hi”)
๐Ÿ”ข

Wrong Type โ€” Mixing Numbers & Text!

Logic Bug

Trying to add a number and text together causes a crash! Convert first using str().

โŒ Bug“Age: ” + 10
โœ… Fixed“Age: ” + str(10)

๐ŸŽฎ Find the Bug!

Interactive Bug Finder!

Read the code โ€” click the line that has the bug!

๐Ÿ•ต๏ธ BUG DETECTIVE

Challenge 1 of 4 ยท Click the buggy line!

find_the_bug.py
๐Ÿ‘† Click the line that has the bug!
Score: 0 / 0

๐Ÿ”ง How to Debug

5 Steps to Fix Any Bug!

Real developers follow these steps every single time!

1
๐Ÿ˜ค

Stay Calm

Bugs are normal! Every coder faces them โ€” even NASA engineers!

2
๐Ÿ“–

Read Error

The error message tells you what went wrong and which line!

3
๐Ÿ‘€

Check Line

Go to that line. Look for typos, missing quotes, or wrong spacing.

4
๐Ÿ”ง

Fix & Run

Make your fix and run the code again. Repeat until it works!

5
๐ŸŽ‰

Celebrate!

Fixed it? Do a happy dance! Every bug fixed = better coder! ๐Ÿ•บ

๐Ÿ†๐ŸŽ“๐Ÿš€

FINAL LESSON COMPLETE!

You’ve finished all 13 coding concepts! You’re officially a Junior Code Detective. Now go build something amazing! ๐ŸŒŸ


๐Ÿง  Final Quiz!
๐ŸŽฏ DEBUGGING QUIZ

4 questions ยท your final challenge!

โญ REMEMBER THIS!

๐Ÿ›

A bug is any mistake that stops your code working

๐Ÿ“–

Always read the error message โ€” it tells you where to look!

๐Ÿ˜Œ

Bugs are totally normal โ€” even pro coders fix bugs daily

๐Ÿ†

Every bug you fix makes you a smarter coder!