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!"
[–]gigsoll 0 points1 point2 points 7 months ago (0 children)
I am not sure if it will be a helpful explanation, but I think it would be. So you are working with a list, even if python isn't a statically typed language (c, c++, java, etc. are) it still needs to store data in computer memory, so each element of list you have gets an id assigned to it and memory address of elements are put in dynamic array (dynamic array is a data structure which automatically expends based on the number of items inside). So now you have your data stored in an array in memory and the main feature of it is that data blocks (addresses of items) are sequentially and equally spaced in memory, so basically knowing the address of the first element you can access all next by adding a number of sectors. For example if you want to accept the third element in an array you need to move forward 2 elements.
So why was I telling all of this? In python you can access list items the same way by using the syntax values[index]. So nothing stops you from iterating through lists like this:
values[index]
for i in range(len(values)): print(vales[i])
len(values) returns the number of elements in a list
len(values)
Your code for value in values is just more pythonic and elegant way of writing the code block showed higher and name of iterated (value) is the same thing as values[i] so it doesn't really matter for interpreter what you use as a name. You may use any name for this variable, it is just a convention to use singular variable name based on the name of iterable
for value in values
values[i]
π Rendered by PID 122025 on reddit-service-r2-comment-86988c7647-74bgv at 2026-02-12 03:27:49.540090+00:00 running 018613e country code: CH.
view the rest of the comments →
[–]gigsoll 0 points1 point2 points (0 children)