O
3

My first Python loop printed the same number 100 times...

I was trying to make a simple counter from 1 to 100, but I accidentally used `while count < 100:` without increasing the count variable inside the loop. It just printed '1' over and over until I stopped it. What's the most common beginner mistake you've made with loops?
2 comments

Log in to join the discussion

Log In
2 Comments
white.seth
white.seth23d ago
Ever forget to update the thing you're checking in the loop condition? I spent an hour once with a while loop that just kept asking for user input because I wrote "while response != 'yes'" but never actually changed the response variable inside the loop. It just asked the same question forever. Felt like a real conversation with a brick wall.
6
nguyen.dylan
Oh man, I started adding a comment right after the input line to remind myself.
4