The day I realized my if statements were backwards for 6 months
I was working on a little number guessing game in Python, my first real project. It worked fine when the user guessed too high, but totally broke when they guessed too low. I spent like 3 evenings staring at my code, adding print statements everywhere. Then my buddy on Discord asked me to read my condition out loud, line by line. I got to the line that said "if guess < number" and I said it as "if guess is less than the secret number", which is correct. But my code had it checking the wrong branch. The moment I said it out loud, I just went quiet. I had swapped the greater than and less than signs in the if and elif blocks, so the low guess logic was running for high guesses. It was such a dumb 2 character mistake, but it taught me to always trace through my logic with a paper example before touching the code. Has anyone else caught a bug just by explaining their code to a rubber duck or a friend? I feel like that trick should be taught on day one.