S
1

Serious question, why did my for loop crash Chrome 3 times last night?

I was sitting in my dorm room at 11 PM trying to finish this simple Python assignment for my intro class. The task was just to print out numbers 1 through 10 using a while loop. But I got clever and decided to use a for loop instead because the tutorial said it was cleaner. I typed it up, hit run, and Chrome just froze solid. My roommate thought I downloaded a virus. After the third crash, I noticed I forgot to include a range function and accidentally wrote "for i in 10" instead of "for i in range(10)". The loop kept going forever and ate up all my RAM. Has anyone else had a silly typo like that totally wreck their whole setup? I felt so dumb but also kinda proud I figured it out.
3 comments

Log in to join the discussion

Log In
3 Comments
ray_miller41
Blame the browser not your code, Chrome should be able to handle a simple infinite loop.
6
william_henderson
Ha, @sam_murphy39 and I must be in the same jet engine club with our bad code.
5
sam_murphy39
Forgot a colon in my own loop once and my laptop sounded like a jet engine taking off.
4