T
3

My first Python loop printed the same number 100 times and I felt so dumb

I was following a tutorial on making a simple counter. The code looked right, but when I ran it, the console just showed '1' over and over, a solid wall of it. I stared at my screen for like 20 minutes, totally lost. The problem was I wrote 'while x == 1:' instead of 'while x < 100:'. I was so focused on the indentation and the print command that I missed the basic logic. It taught me to slow down and read each line out loud before I hit run. Now I check my comparison operators twice. Has anyone else gotten stuck on a tiny typo that made your program do something totally weird?
3 comments

Log in to join the discussion

Log In
3 Comments
william_jenkins
Oh man, that's a classic! I've stared at my own walls of text more times than I can count.
0
eric359
eric35911d ago
Tell me about it! I've done that exact thing so many times. You finally hit post and then immediately see a huge block of your own words staring back. It just looks so dense on the screen. I've gone back and added line breaks more than once after the fact, just to give some poor reader's eyes a break.
4
keith_thompson
Friend's loop printed "hello world" forever.
-1