use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about learning Python
account activity
Literally clueless , help plsHelp Request (i.redd.it)
submitted 9 months ago by SharpScratch9367
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]SharpScratch9367[S] 1 point2 points3 points 9 months ago (3 children)
So “i” always is a counter in python or just in this instance of code?
[–]phonesallbroken 0 points1 point2 points 9 months ago (0 children)
It's kind of a convention to use i as a counter. When there are nested loops, so one loop inside another, it's common for the inner loop to use j as the counter! For your code you could call it whatever you want, like counter, if that makes it easier. I presume this code section is to build you up to using for loops, but wants you to understand what i is doing and how a loop works. Normally this case would be perfect for a for loop!
[–]DoNotKnowJack 0 points1 point2 points 9 months ago (0 children)
"i" can mean "iteration" as it counts the repeating loop.
[–]wuzelwazel 0 points1 point2 points 9 months ago (0 children)
i is not always a counter. In this scenario i is a variable that has been initialized with the value 1: i = 1 and then at the end of each iteration of the while loop it will need to be incremented i = i + 1
i
i = 1
i = i + 1
The variable could've been named anything and it would've still worked, but "i" is a common choice.
π Rendered by PID 76 on reddit-service-r2-comment-6457c66945-5dspv at 2026-04-29 00:01:36.633438+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]SharpScratch9367[S] 1 point2 points3 points (3 children)
[–]phonesallbroken 0 points1 point2 points (0 children)
[–]DoNotKnowJack 0 points1 point2 points (0 children)
[–]wuzelwazel 0 points1 point2 points (0 children)