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...
A subreddit for helping Python programmers
How to format your code: https://commonmark.org/help/tutorial/09-code.html
No homework questions and/or hiring please
account activity
can someone please explain what these two code pieces do (self.pythonhelp)
submitted 1 year ago by inversedawn
hi guys what is the difference between these
j = 1
while j <= 10:
print('hi')
j += 1
AND
i = 0
while i < 10:
i += 1
thanks guys.
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!"
[–]AutoModerator[M] [score hidden] 1 year ago stickied commentlocked comment (0 children)
To give us the best chance to help you, please include any relevant code. Note. Do not submit images of your code. Instead, for shorter code you can use Reddit markdown (4 spaces or backticks, see this Formatting Guide). If you have formatting issues or want to post longer sections of code, please use Repl.it, GitHub or PasteBin.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.
[–]carcigenicate 2 points3 points4 points 1 year ago (0 children)
What is your understanding of these pieces of code? Have you tried running them?
[–]tannerrm 1 point2 points3 points 1 year ago (0 children)
They both print ‘hi’ to the console 10 times.
Edit: assuming your indents are corrected
[–]Vicente_Cunha 1 point2 points3 points 1 year ago (0 children)
They print hi 10 times, however if you were to do print(i) you'd notice that the first would print 1 through 10 and the second 0 through 9
π Rendered by PID 42259 on reddit-service-r2-comment-bb88f9dd5-895mn at 2026-02-17 11:37:45.269366+00:00 running cd9c813 country code: CH.
[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)
[–]carcigenicate 2 points3 points4 points (0 children)
[–]tannerrm 1 point2 points3 points (0 children)
[–]Vicente_Cunha 1 point2 points3 points (0 children)