💡
23

Question about debugging a simple loop that took me 3 hours

I was trying to print numbers 1 to 10 in Python, but my loop kept stopping at 9. The issue was a classic off-by-one error in my range function. Has anyone else spent way too long on a tiny mistake like that?
3 comments

Log in to join the discussion

Log In
3 Comments
beth_singh
Wasn't the range supposed to go to 11?
4
elliot_gibson27
Remember that article about marketing hype? They always promise these big numbers but the real world tests show something else. I saw a breakdown where the actual range was more like 8 or 9 under normal conditions. Makes you wonder where they even get the 11 from. Probably a perfect day with no wind going downhill.
2
robins83
robins838d ago
Check the testing standards they use. They run it on a closed course with specific speeds and temps. Real world adds traffic, weather, different driving styles. That's where the gap comes from.
3