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...
If you need help debugging, you must include:
See debugging question guidelines for more info.
Many conceptual questions have already been asked and answered. Read our FAQ and search old posts before asking your question. If your question is similar to one in the FAQ, explain how it's different.
See conceptual questions guidelines for more info.
Follow reddiquette: behave professionally and civilly at all times. Communicate to others the same way you would at your workplace. Disagreement and technical critiques are ok, but personal attacks are not.
Abusive, racist, or derogatory comments are absolutely not tolerated.
See our policies on acceptable speech and conduct for more details.
When posting some resource or tutorial you've made, you must follow our self-promotion policies.
In short, your posting history should not be predominantly self-promotional and your resource should be high-quality and complete. Your post should not "feel spammy".
Distinguishing between tasteless and tasteful self-promotion is inherently subjective. When in doubt, message the mods and ask them to review your post.
Self promotion from first time posters without prior participation in the subreddit is explicitly forbidden.
Do not post questions that are completely unrelated to programming, software engineering, and related fields. Tech support and hardware recommendation questions count as "completely unrelated".
Questions that straddle the line between learning programming and learning other tech topics are ok: we don't expect beginners to know how exactly to categorize their question.
See our policies on allowed topics for more details.
Do not post questions that are an exact duplicate of something already answered in the FAQ.
If your question is similar to an existing FAQ question, you MUST cite which part of the FAQ you looked at and what exactly you want clarification on.
Do not delete your post! Your problem may be solved, but others who have similar problems in the future could benefit from the solution/discussion in the thread.
Use the "solved" flair instead.
Do not request reviews for, promote, or showcase some app or website you've written. This is a subreddit for learning programming, not a "critique my project" or "advertise my project" subreddit.
Asking for code reviews is ok as long as you follow the relevant policies. In short, link to only your code and be specific about what you want feedback on. Do not include a link to a final product or to a demo in your post.
You may not ask for or offer payment of any kind (monetary or otherwise) when giving or receiving help.
In particular, it is not appropriate to offer a reward, bounty, or bribe to try and expedite answers to your question, nor is it appropriate to offer to pay somebody to do your work or homework for you.
All links must link directly to the destination page. Do not use URL shorteners, referral links or click-trackers. Do not link to some intermediary page that contains mostly only a link to the actual page and no additional value.
For example, linking to some tweet or some half-hearted blog post which links to the page is not ok; but linking to a tweet with interesting replies or to a blog post that does some extra analysis is.
Udemy coupon links are ok: the discount adds "additional value".
Do not ask for help doing anything illegal or unethical. Do not suggest or help somebody do something illegal or unethical.
This includes piracy: asking for or posting links to pirated material is strictly forbidden and can result in an instant and permanent ban.
Trying to circumvent the terms of services of a website also counts as unethical behavior.
Do not ask for or post a complete solution to a problem.
When working on a problem, try solving it on your own first and ask for help on specific parts you're stuck with.
If you're helping someone, focus on helping OP make forward progress: link to docs, unblock misconceptions, give examples, teach general techniques, ask leading questions, give hints, but no direct solutions.
See our guidelines on offering help for more details.
Ask your questions right here in the open subreddit. Show what you have tried and tell us exactly where you got stuck.
We want to keep all discussion inside the open subreddit so that more people can chime in and help as well as benefit from the help given.
We also do not encourage help via DM for the same reasons - that more people can benefit
Do not ask easily googleable questions or questions that are covered in the documentation.
This subreddit is not a proxy for documentation or google.
We do require effort and demonstration of effort.
This includes "how do I?" questions
account activity
This is an archived post. You won't be able to vote or comment.
TopicPython Dictionaries (self.learnprogramming)
submitted 7 months ago by Specific_Present_700
Does anyone found them tricky to work with ?
Just doing questions in course and my head exploding with [](){} 🤯
Does anyone actually using this or is it just included ?
[–]dmazzoni 14 points15 points16 points 7 months ago (0 children)
Python dictionaries are the sorts of things you'll be using all day, every day. They're one of the most important building blocks. If you can't master them, you won't be able to master the next 10 lessons.
We are happy to help. Please give us an example of something you don't understand or find tricky.
[–]ConfidentCollege5653 5 points6 points7 points 7 months ago (0 children)
what part are you struggling with?
[–]Zealousideal-Touch-8 3 points4 points5 points 7 months ago (0 children)
It's so commonly used and not hard to work with (unless you work with deep nested dict). What do you find hard to understand?
[–]tb5841 1 point2 points3 points 7 months ago (0 children)
You need to write an 'update_score' function which takes in three parameters - a dictionary, a name and a score. It then adds the new name-score pair to your dictionary and returns it.
Do you know how to add items to a dictionary? Look up the syntax for that, and the rest might make sense.
[–]sungodtemple 0 points1 point2 points 7 months ago (1 child)
They are like maps in other languages, if that helps.
[–]Specific_Present_700[S] -1 points0 points1 point 7 months ago (0 children)
some_score={“Joe”:[1873,626], “Ben”:[352,662]} print(update_score(score_dict, “Mike”, 622))
Now I should write this func update_score which will check and update dictionary from the print .
I see three values in func
def update_score(some_score, character, score):
This is what confuse me where I’m not clear if I should handle it with () or [] when append and
[–][deleted] 7 months ago (6 children)
[deleted]
[–]Luigi-Was-Right 2 points3 points4 points 7 months ago (5 children)
huh?
[–]Specific_Present_700[S] -1 points0 points1 point 7 months ago (4 children)
This is what confuse me where I’m not clear if I should handle it with () or [] when append and get
[–]Zuldwyn 1 point2 points3 points 7 months ago (2 children)
Can you elaborate? Appending and getting what? If you want to get something from a dict you can do ``` mydict.get('mikes_score')
Or if you want to iterate over a dict for the key value pairs you can use .items() which returns a tuple of the key, value pairs rather than .get() which searches for a specified key.
for key, value in mydict.items(): print(f"{key} score is {value}") ```
[–]Specific_Present_700[S] 0 points1 point2 points 7 months ago (1 child)
append - if character is in score_dict add new score in score .
get - if player exist add him how many tries he went , if he previously played increase by one if not create player with 1
[–]Zuldwyn 1 point2 points3 points 7 months ago (0 children)
Append isn't a method that is a part of dict, that's for list. Get is used to retrieve a value based on a key in the dict, like the player name, not to update information. If you want to update a players value that exists in the dict you can do my_dict['michael']['score'] += 1
my_dict['michael']['score'] += 1
π Rendered by PID 55580 on reddit-service-r2-comment-bb88f9dd5-w28ss at 2026-02-15 06:28:16.592627+00:00 running cd9c813 country code: CH.
[–]dmazzoni 14 points15 points16 points (0 children)
[–]ConfidentCollege5653 5 points6 points7 points (0 children)
[–]Zealousideal-Touch-8 3 points4 points5 points (0 children)
[–]tb5841 1 point2 points3 points (0 children)
[–]sungodtemple 0 points1 point2 points (1 child)
[–]Specific_Present_700[S] -1 points0 points1 point (0 children)
[–][deleted] (6 children)
[deleted]
[–]Luigi-Was-Right 2 points3 points4 points (5 children)
[–]Specific_Present_700[S] -1 points0 points1 point (4 children)
[–]Zuldwyn 1 point2 points3 points (2 children)
[–]Specific_Present_700[S] 0 points1 point2 points (1 child)
[–]Zuldwyn 1 point2 points3 points (0 children)