21
Question about a simple Python loop that took me 3 hours to fix
I was trying to make a list of numbers from 1 to 10, but my code kept printing the number 10 over and over. The issue was a tiny typo where I wrote 'range(1,10)' instead of 'range(1,11)' inside the loop. Do you think beginners should focus more on small syntax errors or bigger logic problems first?
3 comments
Log in to join the discussion
Log In3 Comments
angela_king3910d ago
Wait, three whole hours for that?
4
young.drew4d ago
Yeah it's wild how that happens... like you start fixing one small thing and suddenly the whole afternoon is gone. I get what you mean Angela, three hours feels crazy but it's never just about the comma or the one line of code. It's about chasing down why it feels wrong, which opens up ten other little problems. Our brains get stuck on making things perfect even when they're already good enough. I've seen this same loop mess up dinner plans, DIY projects, everything really.
1