B
9

My first program ran 42 times before I noticed the typo

I was trying to make a simple loop in Python last week, just to print numbers from 1 to 10. I accidentally typed 'range(42)' instead of 'range(10)' and walked away. Came back to my terminal in Seattle just scrolling the same numbers over and over. It was my first time hitting a number that big in my own code, even if it was a mistake. Anyone else have a silly bug that made you learn something basic the hard way?
3 comments

Log in to join the discussion

Log In
3 Comments
adamk95
adamk9513d ago
Honestly I see that as a win, you got to watch your code run without crashing. My first loop mistake just froze the whole thing because I forgot the increment. That silent scroll is way better than a lock up.
4
the_jennifer
My first infinite loop printed "hello world" about ten thousand times before I killed it. That feeling of watching your output just go nuts is a special kind of panic. At least a full lockup forces you to restart, but the silent scroll lets you sit there in pure dread. I remember just staring at the terminal, my brain slowly catching up to what my code was doing. Those early mistakes really do stick with you more than the successes sometimes.
3
susan_wright34
Right? That slow scroll is its own special horror movie. I still get that sinking feeling when I see text flying by too fast to read. It's like your computer is laughing at you while it does exactly what you told it to do. Those early loops taught me to double check my conditions way more than any lecture ever did.
3