24
Question about a Python script that crashed my computer last night
I was trying to follow a tutorial to make a simple number guessing game. I wrote a while loop to keep asking for guesses, but I forgot to add a way to stop it. My laptop froze completely after about 30 seconds and I had to hold the power button. I'm not sure if the problem was my bad code or if my old laptop just can't handle it. Has anyone else had a loop crash their system, and how do you avoid that?
3 comments
Log in to join the discussion
Log In3 Comments
wilson.sam1mo ago
Welcome to the infinite loop club, it's a rite of passage lol. That's definitely your code eating up all the RAM because it never breaks out. Next time, maybe add a hard limit on guesses or print something each loop so you can see it's still running.
4
angela_grant23d ago
Printing each loop can still fill your logs fast, @wilson.sam.
3