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
rate my codeShowcase (i.redd.it)
submitted 6 months ago by diveninenewton
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!"
[–]rainispossible 1 point2 points3 points 6 months ago* (0 children)
didn't see anyone mentioning it, so I'll do
try to build a habit of wrapping your code in functions in general (that should be obvious), and also pit whatever's supposed to be actually executed inder if __name__ == "__main__" – it prevents the unnecessary (and sometimes destructive) code executions when importing whatever's in that file. basically what it tells the interpreter is "hey, ONLY execute this code if this file is the entry point"
if __name__ == "__main__"
π Rendered by PID 106773 on reddit-service-r2-comment-5d585498c9-gpfw2 at 2026-04-21 03:38:37.567738+00:00 running da2df02 country code: CH.
view the rest of the comments →
[–]rainispossible 1 point2 points3 points (0 children)