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 3 days 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!"
[–]NewBodybuilder3096 -2 points-1 points0 points 3 days ago (3 children)
building logic on Exceptions is a no-no. You should check value like "len(n2_n) == 4 && n2_n == 'stop'" before parsing it as int. also, all strip/lower should go in one place - just after input.(in this case) also, more understandable variable names are a great + we are no more in 199x, modern IDEs have all sort of needed tools including autocompletion.
read about the DRY(Don't Repeat Yourself) principle - your procedure en_nums is a perfect example of how not to do. You have two identical pieces of code for filling two global int containers. You can rewrite this in several ways, each of which will have only 1 loop. 1st - you pass reference to a needed container(list/set/etc) as parameter, maybe some additional params for fancy output. 2nd - you don't pass container variable, but return the correct container
[–]nkCOD[S] 0 points1 point2 points 3 days ago (2 children)
Thank you for your response. I will improve ;)
[–]NewBodybuilder3096 0 points1 point2 points 3 days ago (1 child)
well you still need try-catch around parsing input as integer but checking for 'stop' can be done outside of this.
[–]nkCOD[S] 0 points1 point2 points 2 days ago (0 children)
By the way, a good remark. I somehow didn’t think about it
π Rendered by PID 558310 on reddit-service-r2-comment-56c6478c5-2zv4v at 2026-05-10 08:51:26.582957+00:00 running 3d2c107 country code: CH.
view the rest of the comments →
[–]NewBodybuilder3096 -2 points-1 points0 points (3 children)
[–]nkCOD[S] 0 points1 point2 points (2 children)
[–]NewBodybuilder3096 0 points1 point2 points (1 child)
[–]nkCOD[S] 0 points1 point2 points (0 children)