Pro tip: my nested for loop printed 47 lines of junk before I caught the real bug, took me 3 hours on a Tuesday
I started learning Python about 5 months ago and last Tuesday I hit a wall that made me want to close my laptop for good. I was trying to write a little script that reads a list of names and prints them in pairs, and it kept spitting out 47 lines of nonsense instead of the 5 pairs I expected. I stared at the loop for an hour and a half, changing random things like the print statement and the range, and nothing worked. I asked in a Discord server and a guy named Marcus pointed out my inner loop kept restarting because I put it in the wrong spot, so every name got matched with every other name instead of just the one next to it. I moved one line of indentation and it ran perfect in about 2 seconds. The whole thing took me 3 hours to fix what turned out to be a single tab press. I keep reading that indentation matters in Python but I guess I had to feel it in my bones first. Has anyone else had a bug that ended up being one dumb line after hours of guessing?