F
21

My first Python script broke because I forgot a colon

I was trying to make a simple number guesser in Python last Tuesday, following a tutorial from a site called LearnPythonTheHardWay. The code looked right but it kept throwing a syntax error for 20 minutes straight. Turns out I missed a single colon after an 'if' statement on line 7. Has anyone else had a tiny mistake waste a big chunk of their night?
3 comments

Log in to join the discussion

Log In
3 Comments
mila_murphy
Welcome to programming. I once spent three hours on a missing comma in a list. The computer doesn't care if your code is almost right, it only cares if it's perfect. That colon is the gatekeeper to your whole program running. You'll learn to spot those little typos faster, but they'll always bite you when you're tired.
3
caseywalker
Actually that strictness is what makes programming good. It forces clear thinking. If the computer let sloppy code run, we'd have way more bugs in real software. Those three hours teach you to be careful in a way nothing else can.
8
averyc94
averyc941mo ago
Three hours on a comma?! That's brutal, I would have lost my mind! I once spent a whole afternoon because I used a capital O instead of a zero in a password. It looked exactly the same in my font. The worst part is you're convinced it's some huge logic error the whole time.
3