Pro tip: naming variables like actual words killed my bug hunting time
I used to write stuff like x, temp, and a1 in my little practice scripts, and spent two evenings hunting down why my totals kept coming out wrong. Turned out I had two different variables both shorted to "t" in different spots, and the moment I started writing them out as total_price and item_count, the bug was obvious in five seconds. Does anyone else have a naming habit like that, or am I just slow for not doing it sooner?
Small pushback on the idea that the fix was the long names. The names did not show you the bug, the fact that the two variables looked different did. You could have called them t1 and t2 and spotted it just as fast. I ran into this with loop vars a while back, i and j, and the real mistake was using one letter at all in nested loops, not that the names were short. Long names help when you read code later, but the bug was two things sharing a name, and that's true of total_price and totalPrice too. Your mileage may vary on how much naming style matters versus just not reusing stuff.