Rant: my first Python script printed 'Hello World' 47 times and I still don't know why
I ran my first loop last week and instead of printing once, it went wild and spat out the same line 47 times until I hit Ctrl+C. The colon I put at the end of the print line was the culprit. Has anyone else panicked and killed a program before reading the error message?
Something like this happened to a buddy of mine back in college. He was messing around with a while loop for a class project and forgot to update his counter variable inside the loop. That thing ran for a solid two minutes printing the same line while his laptop fan spun up like a jet engine. He freaked out and just slammed the power button because he thought he broke something. Turned out he just had to hit Ctrl+C, which is way easier than a hard shutdown. The colon thing you ran into is a classic too, that little typo can make Python think you want a whole block of code when you really just want one line. Reading the error message first saves so much drama, but honestly almost nobody does that when they are starting out.