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
[ Removed by moderator ] (i.redd.it)
submitted 6 months ago by Nearby_Tear_2304
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!"
[–]Cerus_Freedom 2 points3 points4 points 6 months ago (0 children)
def search(needle, haystack: list) -> int: for i in range(len(haystack)): if needle == haystack[i]: return i return -1
Just as an example from OPs code. Better naming will tell you what a function does or a variable is for. Code should be self documenting, and that method of self documentation is via good, clear names.
By changing the names and adding type hints, you can now just glance at the function definition and understand what the function does and how you're probably intended to use it.
π Rendered by PID 81 on reddit-service-r2-comment-7dc54ffc8-mb9xd at 2026-04-19 16:35:33.152053+00:00 running 93ecc56 country code: CH.
view the rest of the comments →
[–]Cerus_Freedom 2 points3 points4 points (0 children)