Debugging in Python with Angela Yu's 100 Days Course

🚀 Day 13 of #100DaysOfCode – Learning How to Debug Like a Developer! Today I continued Angela Yu’s 100 Days of Python course and focused on one of the most important skills in programming: Debugging 🐞➡️✅ 🔹 What I learned today: 🔹How to describe the problem clearly 🔹How to reproduce a bug 🔹“Play computer” and evaluate code line by line 🔹Using print() statements to trace issues 🔹Fixing errors by understanding red underlines 🔹Using a debugger and applying final debugging tips 🔹 Simple Debugging Examples: 1️⃣ Logic Error age = 15 if age > 18: print("Adult") else: print("Teen") ➡️ Bug: Condition excludes age 18 ✅ Fix: Use age >= 18 2️⃣ Type Error number = input("Enter a number: ") print(number + 5) ➡️ Bug: Cannot add string and integer ✅ Fix: number = int(input("Enter a number: ")) print(number + 5) 3️⃣ List Index Error fruits = ["apple", "banana"] print(fruits[2]) ➡️ Bug: Index out of range ✅ Fix: print(fruits[1]) 4️⃣ Dictionary Key Error student = {"name": "Abhishek", "age": 22} print(student["score"]) ➡️ Bug: Key does not exist ✅ Fix: print(student.get("score", "Key not found")) 5️⃣ Using print() to Debug for i in range(1, 5): print("Current value of i:", i) ➡️ Helps track how the loop runs step by step Learning debugging made me realize that errors are not failures—they’re clues. Every bug helps build better problem-solving skills. Excited to keep improving and move on to Day 14! 🚀 #Python #100DaysOfCode #LearningInPublic #CodingJourney

To view or add a comment, sign in

Explore content categories