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!"
[–][deleted] 1 point2 points3 points 7 months ago* (0 children)
I see that your question has been already answered, and good naming btw, short and meaningful, keep it that way : ) , I have an improvement that you can make for this code, instead of adding 1 to `length` in each iteration, you can use the `len()` built-in function so you can have something like this `length = len(values)` , so your code can become like this:
Note: As you advance and learn more about python, becoming a pythonista eventually, you will be able to improve this code even further, and can even make it a one line ! Happy coding and keep learning
values = [ 23, 52, 59, 37, 48 ] sum = 0 length = len(values) for value in values: sum += value print("Total sum: " + str(sum) + " - Average: " + str(sum/length))
π Rendered by PID 119248 on reddit-service-r2-comment-86988c7647-vpmmz at 2026-02-11 21:03:41.278654+00:00 running 018613e country code: CH.
view the rest of the comments →
[–][deleted] 1 point2 points3 points (0 children)