Vent: my loops kept printing the wrong total until I found one dumb typo at 1am
Sat at my kitchen table in Toledo retyping the same 12 lines of Python for the fourth time because my total kept coming out as 0 instead of 36. Turned out I wrote the variable as "totl" on line 7 and "total" in the print line, so it was just printing an empty spot, took me 40 minutes to spot it. Felt so good when the right number popped up that I actually yelled. How do you all catch typos like that, do you print stuff as you go or just stare at it like I did?
Why stare at it for 40 minutes when your computer can just tell you what's wrong?
I get the urge to hunt for it yourself, but that's the slow way. In my experience, half the time you can't see your own typo because your brain reads what you meant to write, not what's actually there. Python will flat out tell you if you run it right, it says something like name 'totl' is not defined, and there's your answer in two seconds. If the name shows up empty instead of erroring, drop a print statement above the line and watch where it goes wrong. Staring harder just makes your eyes tired, and at 1am that is a losing game.