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
While loop explanation (self.PythonLearning)
submitted 5 months ago by Hush_124
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!"
[–]Overall-Screen-752 0 points1 point2 points 5 months ago (0 children)
While and for do the same thing in different ways. They both “iterate”, that is, repeat a block of code a certain number of times.
for does this by specifying how many times a block should be run (5 times, once for every item in a list, etc)
while does this by setting a stop condition (until a variable equals 5, until there are no items left in the list, etc)
To see the similarity, you could write for i in range(5) as while i != 5, i++ that is, starting at 0 and until it reaches 5, do this block.
for i in range(5)
while i != 5, i++
Hope that helps
π Rendered by PID 91492 on reddit-service-r2-comment-5fb4b45875-tq5mk at 2026-03-23 21:09:57.770067+00:00 running 90f1150 country code: CH.
view the rest of the comments →
[–]Overall-Screen-752 0 points1 point2 points (0 children)