Practice and reinforce the concepts from Lesson 13
⏰ Time Estimate: 45-60 minutes
🎯 What You'll Master:
Welcome, young detective! 🔍 In this special debugging challenge, you'll put on your detective hat and solve coding mysteries. Each challenge is a puzzle waiting to be solved. Remember: Every bug you find makes you a stronger coder! Mistakes are just stepping stones to success - even the best programmers debug code every day!
💡 Detective Tip!
Create a separate project for each challenge. This makes it easier to submit your work and keeps your detective case files organized! 🗂️
Create a guessing game where users try to guess your favorite dessert! 🍰
🎯 Program Requirements:
💡 Detective Clue #1
Think about what you need:
- A variable to store YOUR favorite dessert
- An input block to get the user's guess
- An if/else statement to check the answer Don't forget to make your messages friendly! 😊
Evidence File A: Correct Guess
Evidence File B: Wrong Guess
Create a program that randomly picks one of YOUR favorite desserts and asks if the user likes it too! 🍨
🎯 Program Requirements:
💡 Detective Clue #2
Building blocks you'll need:
- A list to store multiple desserts
- The random.choice() function
- An input block for yes/no response
- An if/else statement for different reactions Remember: Make your responses sound natural and friendly!
Evidence File A: User Says Yes
Evidence File B: User Says No
A fellow coder needs your help! Their code has bugs and won't run properly. Can you spot what's wrong? 🐛
💡 Detective Clue #3
Common bug hideouts to check:
- Missing quotation marks or parentheses
- Wrong variable names
- Incorrect indentation
- Logic that doesn't make sense Take your time - good detectives are thorough! 🔍
The Broken Code:
Your Target Output:
⚠️ Detective Warning: Don't just copy the answer! Understanding WHY the bug happened will make you a better coder!
A calculator program is broken! It should add two numbers, but something's not working right. Time to investigate! 🧮
🎯 The Program Should:
💡 Detective Clue #4
Math bugs often hide in:
- Input conversion (strings vs numbers)
- Variable naming mistakes
- Calculation order
- Output formatting Remember: Computers need exact instructions! 🤖
The Suspicious Code:
Expected Behavior When Fixed:
💡 Pro Detective Move: Test with easy numbers first (like 5 + 5) to make sure it's working!
This is your toughest case yet! The program has multiple bugs involving variables and output. Can you solve them all? 🎯
💡 Detective Clue #5
Advanced bug patterns to watch for:
- Variables used before they're defined
- Wrong variable names in different parts
- Missing spaces or formatting in output
- Type mismatches (text vs numbers) You're almost a debugging master! 🏆
The Complex Case:
Your Success Target:
🌟 Detective Achievement: If you solve this one, you've proven you can debug like a pro!
If you're stuck, try these detective techniques:
Ready for some extra detective work? Try these bonus challenges:
You've completed all 5 debugging challenges! 🕵️♂️✨
What You've Accomplished:
Remember: Every programmer is also a debugger! The skills you've learned today will help you for your entire coding journey. Bugs aren't enemies - they're puzzles that make you smarter! 🧩
You've solved all the cases! Now it's time to submit your detective work:
🎯 Submit Your 5 Debugging Projects Here
📋 Submission Checklist:
Note: You need to submit 5 project links for this activity - one for each debugging challenge.
🌟 You're now an official Code Detective! Keep those debugging skills sharp! 🌟