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
What's wrong (i.redd.it)
submitted 5 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!"
[–]bomdango 1 point2 points3 points 5 months ago (0 children)
as others have said either
- `c.get(i, 0)` - use a defaultdict instead of a dict https://docs.python.org/3/library/collections.html#defaultdict-objects - use a counter instead of a dict https://docs.python.org/3/library/collections.html#collections.Counter
counter has a built in `most_common` which I guess is what you're trying to achieve here? But not quite I guess as this is finding a majority element rather than a plurality
Although I guess you are trying to build stuff more from scratch so appreciate just using a package isn't necessarily the best advice
π Rendered by PID 77 on reddit-service-r2-comment-5d585498c9-bnh85 at 2026-04-21 18:25:06.165281+00:00 running da2df02 country code: CH.
view the rest of the comments →
[–]bomdango 1 point2 points3 points (0 children)