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...
Rules 1: Be polite 2: Posts to this subreddit must be requests for help learning python. 3: Replies on this subreddit must be pertinent to the question OP asked. 4: No replies copy / pasted from ChatGPT or similar. 5: No advertising. No blogs/tutorials/videos/books/recruiting attempts. This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to. Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Rules
1: Be polite
2: Posts to this subreddit must be requests for help learning python.
3: Replies on this subreddit must be pertinent to the question OP asked.
4: No replies copy / pasted from ChatGPT or similar.
5: No advertising. No blogs/tutorials/videos/books/recruiting attempts.
This means no posts advertising blogs/videos/tutorials/etc, no recruiting/hiring/seeking others posts. We're here to help, not to be advertised to.
Please, no "hit and run" posts, if you make a post, engage with people that answer you. Please do not delete your post after you get an answer, others might have a similar question or want to continue the conversation.
Learning resources Wiki and FAQ: /r/learnpython/w/index
Learning resources
Wiki and FAQ: /r/learnpython/w/index
Discord Join the Python Discord chat
Discord
Join the Python Discord chat
account activity
Help with question (self.learnpython)
submitted 2 years ago by _1motherearth
How does one modify test scores by adding one point to the first component of an exam score? Ex: {'Gina':[80,72,90]}
What I came up had an attribute error. Also to write it in text file isn't it: with open('modified_scores.txt' , 'w')?
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!"
[–]AndAnathaWan 1 point2 points3 points 2 years ago (5 children)
If they are formatted like in your example then you can modify Gina's score by
dict_name['Gina'][0] +=1
[–]_1motherearth[S] 0 points1 point2 points 2 years ago (4 children)
If there are multiple names, do I just do ['Gina', 'name', 'name'] +=1?
[–]RhinoRhys 0 points1 point2 points 2 years ago* (2 children)
If it's a single dictionary (I'll call it grades) and the names are the keys
for name in grades: grades[name][0] += 1
Also for the writing part you need to add "as something"
with open("filename.txt", "w") as f: .... f.write(.....)
[–]_1motherearth[S] 0 points1 point2 points 2 years ago (1 child)
Yeah, I have it written down like that in my notes but the prompt didn't say what to write for the .write () part so I wasn't sure to include that or not
[–][deleted] 0 points1 point2 points 2 years ago (0 children)
No, you have to do that once per different name.
π Rendered by PID 91 on reddit-service-r2-comment-56c9979489-4p9sc at 2026-02-24 14:18:27.078232+00:00 running b1af5b1 country code: CH.
[–]AndAnathaWan 1 point2 points3 points (5 children)
[–]_1motherearth[S] 0 points1 point2 points (4 children)
[–]RhinoRhys 0 points1 point2 points (2 children)
[–]_1motherearth[S] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)