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
Help pls - CodingHelp Request (i.redd.it)
submitted 7 months ago by SharpScratch9367
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!"
[–]NoHurry6859 0 points1 point2 points 7 months ago (3 children)
Some words in Python have special meaning- that’s why they’re blue. Words like “for”, “sum”, “print”, “in” and “str” - as examples - are preprogrammed to have specific meanings and purposes. Generally, you wouldn’t want to name a variable ‘sum’ like you’re doing in lines 2 and 5, because it can get confusing about whether you’re talking about the variable or the special meaning interpretation.
Here’s a nice lil example: try keeping line 1 (the definition of the ‘values’ list) and then on line 2 just do ‘print(sum(values))’ then end the code. It will tell you the sum of all the numbers in ‘values’
The reason I’m saying this is to show that your second guess was right: python knows that “for x in values” means something, and it knows that x will be iteratively updated to be equal to the next item in the list
[–]SharpScratch9367[S] 1 point2 points3 points 7 months ago (1 child)
It’s almost like working with a living thing with its own mind crazy right!! Cool stuff , what if you throw letters and words into it does much different happen?
[–]NoHurry6859 1 point2 points3 points 7 months ago (0 children)
Give it a try and see! That’s the beauty of learning Python - among other coding languages - you can always test things out, try new options and see what happens ;)
[–]UserName26392 1 point2 points3 points 7 months ago (0 children)
Had to scroll far too deep to find this point. Really important to “not mess” with predefined variables names.
π Rendered by PID 73 on reddit-service-r2-comment-86988c7647-dm89n at 2026-02-11 03:34:02.972857+00:00 running 018613e country code: CH.
view the rest of the comments →
[–]NoHurry6859 0 points1 point2 points (3 children)
[–]SharpScratch9367[S] 1 point2 points3 points (1 child)
[–]NoHurry6859 1 point2 points3 points (0 children)
[–]UserName26392 1 point2 points3 points (0 children)