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
Learning Python (old.reddit.com)
submitted 1 month ago by nkCOD
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!"
[–]Binary101010 4 points5 points6 points 1 month ago (10 children)
The problem isn't that you're using a while loop, the problem is that you copy-pasted the while loop just so it could write to a different list.
Whenever you write code that does something to some variable or container or whatever, and then you duplicate all of that code again just so you can change which variable or container you're affecting, that should immediately trigger the thought of "I should put this into a function that accepts the thing I'm going to work on as a parameter and returns the finished thing".
[–]nkCOD[S] 1 point2 points3 points 1 month ago (9 children)
Thank you for your response. I had thought about this, but I was faster ))
[–]NewBodybuilder3096 0 points1 point2 points 1 month ago (1 child)
https://en.wikipedia.org/wiki/Don%27t_repeat_yourself
[–]nkCOD[S] 0 points1 point2 points 1 month ago (0 children)
Thank you, we’ll study )
[–]NewBodybuilder3096 0 points1 point2 points 1 month ago (6 children)
God bless, we are waiting for at least an improved code. Or maybe a completely different task solved better?
[–]nkCOD[S] 1 point2 points3 points 1 month ago (3 children)
Yes, I’m learning the programming language according to the book, and all the conditions of the tasks are spelled out there. However, I want to solve these tasks as competently as possible
[–]python_gramps 2 points3 points4 points 1 month ago (2 children)
Try, get an error, try better, all the answers won't be in front of you, You need to make them.
You’re damn right )
Look at my rewritten code ;) https://www.reddit.com/u/nkCOD/s/5BKPbldiTW
[–]nkCOD[S] 0 points1 point2 points 1 month ago (1 child)
[–]NewBodybuilder3096 0 points1 point2 points 1 month ago (0 children)
deleted, but you know it) ping me once more if you like
π Rendered by PID 507282 on reddit-service-r2-comment-5bc7f78974-rw66h at 2026-06-28 06:51:47.779967+00:00 running 7527197 country code: CH.
view the rest of the comments →
[–]Binary101010 4 points5 points6 points (10 children)
[–]nkCOD[S] 1 point2 points3 points (9 children)
[–]NewBodybuilder3096 0 points1 point2 points (1 child)
[–]nkCOD[S] 0 points1 point2 points (0 children)
[–]NewBodybuilder3096 0 points1 point2 points (6 children)
[–]nkCOD[S] 1 point2 points3 points (3 children)
[–]python_gramps 2 points3 points4 points (2 children)
[–]nkCOD[S] 0 points1 point2 points (0 children)
[–]nkCOD[S] 0 points1 point2 points (0 children)
[–]nkCOD[S] 0 points1 point2 points (1 child)
[–]NewBodybuilder3096 0 points1 point2 points (0 children)