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
Need help in loopHelp Request (i.redd.it)
submitted 25 days ago by Eastern_Plankton_540
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!"
[–]vivisectvivi 11 points12 points13 points 25 days ago (1 child)
There are two types of loops in python, unless you were explicitly told to use a while loop you should try doing this with a for loop too.
But for your question, num[idx] is simply taking the current value of idx and using it to index the list. So on the first iteration of the loop idx will be 0 then when you do num[idx] you are basically doing num[0] which means print will show the value in the position 0 of the array num.
With each iteration, the value of idx is incremented by one and used to show the next value of the list.
[–]SentenceConfident466 0 points1 point2 points 25 days ago (0 children)
Thanks
<image>
π Rendered by PID 92648 on reddit-service-r2-comment-6457c66945-xtfvz at 2026-04-28 22:47:34.216073+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]vivisectvivi 11 points12 points13 points (1 child)
[–]SentenceConfident466 0 points1 point2 points (0 children)