12
My little victory with a stubborn for loop
I was trying to make a list of numbers in Python, but my loop kept leaving the last one out (so annoying). After staring at it for an hour, I tried using `range(1, 11)` instead of `range(1, 10)` and it finally printed all ten numbers. It seems so simple now, but figuring out that the second number isn't included was a big deal for me. Has anyone else had a 'duh' moment with something like range()?
2 comments
Log in to join the discussion
Log In2 Comments
the_jason22d ago
Oh man, that "second number isn't included" thing gets everyone. My friend spent a whole day trying to figure out why his list was one short before he realized the same thing. What was the project you were working on?
10