T
10

My first Python script crashed because I forgot a colon

I was trying to build a simple number guesser game last night, following a tutorial from a site called Codecademy. Everything was fine until I ran it and got a 'SyntaxError' right on line 7. I stared at the screen for a solid ten minutes before I saw it. I had written 'if guess == number' but completely forgot to put the colon at the end. It's such a tiny thing, but the whole program just stops. I felt pretty silly, but adding that one little character fixed it instantly. It's crazy how one missing symbol can break everything. Has anyone else had a simple mistake like that totally stump them when they were starting out?
3 comments

Log in to join the discussion

Log In
3 Comments
jadeg81
jadeg812mo ago
Actually those tiny syntax errors are good, they teach you to be careful from the start.
9
knight.xena
Hard disagree with @jadeg81 honestly. Tiny syntax errors are a massive waste of time and they don't teach you anything useful about programming. They just make you feel dumb for missing a dot or a colon while teaching you nothing about logic or structure. The real lesson is that languages have arbitrary rules that get in the way of actually building stuff. Catching that missing colon didn't make me a better programmer, it just made me paranoid about stupid formatting.
7
kai_west
kai_west2mo ago
I spent an hour debugging a script once because I used a single equals sign in an if statement instead of a double. The error message was about invalid syntax, but my brain just refused to see it. It's wild how our eyes skip over those tiny details.
2