G
7

Spent 3 hours debugging a missing semicolon in Python

I was working on a little guessing game for my first real project. Everything looked fine to me, but the loop kept throwing an error. After staring at the screen for what felt like forever, I realized I forgot a colon after my for statement. In Python, colons are key for loops and functions, not semicolons like in other languages. It was a silly mistake, but it taught me to slow down and check my syntax line by line. Has anyone else had a basic syntax issue trip them up for way too long?
2 comments

Log in to join the discussion

Log In
2 Comments
rileyw72
rileyw721mo ago
Wait, so you were looking for a missing semicolon in Python? That doesn't really work that way since Python doesn't use semicolons at all except for putting multiple statements on one line. You probably meant a missing colon, right? That one gets me all the time too though. Forgetting a colon after a for loop or a function definition can make the whole thing crash and you'll just stare at it forever. Its like your brain sees what it expects to see instead of what's actually there. I've spent a good hour hunting for a colon that was right there the whole time but I just kept glossing over it. Slow and steady is the only way with syntax stuff.
1
wadeg92
wadeg9229d ago
Watched my buddy chase a phantom error for hours once, turned out he forgot the closing parenthesis.
3