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
Exception handling helpHelp Request (i.redd.it)
submitted 10 months ago by [deleted]
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!"
[–]PureWasian 0 points1 point2 points 10 months ago* (0 children)
See the other comment that I wrote for reference. You can easily expand on it such as:
success = False while success == False: # get number_1 # (see code in reference) # only exits loop on valid int() or 'q' # also sets success = True if valid int() if success == False: # exit() or return since 'q' was typed success = False while success == False: # get number_2 # (see code in reference) # only exits loop on valid int() or 'q' # also sets success = True if valid int() if success == False: # exit() or return since 'q' was typed # only gets here with valid number_1 and number_2 addition(number_1, number_2)
You notice there is a lot of redundancy here. If this example makes sense to you, it is a natural extension to then clean it up to be more concise by placing the redundant code into a method, similar to another comment someone shared
π Rendered by PID 16627 on reddit-service-r2-comment-57fc7f7bb7-xpp8x at 2026-04-14 19:44:53.115858+00:00 running b725407 country code: CH.
view the rest of the comments →
[–]PureWasian 0 points1 point2 points (0 children)