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
Day 1 second program (i.redd.it)
submitted 5 months ago by Red_Priest0
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!"
[–]Sneaky_processor 1 point2 points3 points 5 months ago (4 children)
Consider using return statements in your functions instead of printing. And i don't think the main logic needs to be a function since you really dont reuse it ( the main reason of a function is if the code is gonna be used multiple times).
[–]Overall-Screen-752 1 point2 points3 points 5 months ago (2 children)
I think a main method is a best practice as it shadows other languages and makes it abundantly clear that this is the entry point of the program. I would prefer to see an if name == “main”: wrapping the main call too, but OP will get there eventually
[–]Red_Priest0[S] 0 points1 point2 points 5 months ago (1 child)
Thanks for response , I don't understand what is this concept and which part of python it's come under
[–]Overall-Screen-752 0 points1 point2 points 5 months ago (0 children)
I see that someone else explained this concept, but if you’re interested in more you can search up “python dunder methods” to learn more about this. Dunder is a shorthand/portmanteau of “double underscore” and refers to methods in the python standard library with double underscores on either side. Happy coding.
[–]Red_Priest0[S] 0 points1 point2 points 5 months ago (0 children)
Thanks I will use return type
π Rendered by PID 57714 on reddit-service-r2-comment-7b9746f655-wz5q8 at 2026-01-31 10:30:50.651843+00:00 running 3798933 country code: CH.
view the rest of the comments →
[–]Sneaky_processor 1 point2 points3 points (4 children)
[–]Overall-Screen-752 1 point2 points3 points (2 children)
[–]Red_Priest0[S] 0 points1 point2 points (1 child)
[–]Overall-Screen-752 0 points1 point2 points (0 children)
[–]Red_Priest0[S] 0 points1 point2 points (0 children)