My "hello world" printed twice and I spent 3 hours figuring out why | Coding For Beginners - Freelance Forum - The Community for Independent Professionals
My "hello world" printed twice and I spent 3 hours figuring out why
So I'm about 6 weeks into learning Python on my own, working through a free course on my laptop at the kitchen table, and I hit the lesson on functions. The exercise was simple: write a little function that prints a greeting, then call it once. I ran it and my terminal showed the greeting two times. I figured the course site was buggy, refreshed twice, same thing. Turns out I had written the print statement inside the function AND left an old copy of the print line sitting outside the function from the previous lesson, so it fired once from my call and once on its own. Took me roughly 3 hours and a very patient guy on a Discord server asking me to paste my whole file to spot it. The lesson I actually got was to read every line of my own code out loud before asking for help, which sounds dumb but works. Now I'm curious, what was the dumbest bug that ate way more of your time than it should have when you were starting out?