Introduction
Imagine you are trying to fix a broken toy but you don't know what is wrong. The debugging mindset helps you find and fix problems in computer programs by thinking clearly and patiently.
Imagine you are trying to find why a lamp is not working. You check if it is plugged in, if the bulb is good, and if the switch is on. You test each part carefully until you find the broken piece.
┌───────────────┐
│ Problem Found │
└──────┬────────┘
│
▼
┌───────────────┐
│ Stay Calm and │
│ Curious │
└──────┬────────┘
│
▼
┌───────────────┐
│ Break Down the│
│ Problem │
└──────┬────────┘
│
▼
┌───────────────┐
│ Test and │
│ Observe │
└──────┬────────┘
│
▼
┌───────────────┐
│ Use Clear │
│ Steps to Fix │
└───────────────┘debugging mindset when working with code?# symbol to start a comment line.#, which is correct. Others are comment styles for HTML, JavaScript, or C.def add_numbers(a, b):
return a + b
result = add_numbers(3, '4')
print(result)let count = 0;
for(let i = 0; i < 5; i++) {
count = count + i;
}
console.log(count);count is updatedcount is reset to 0 inside the loop each time, it never accumulates.count inside the loop causes it to stay 0 after loop ends.count is reset inside the loop -> Option DPass the test and this pattern moves unknown