Complete beginner, any help appreciated :) - For Loops

Pedro Henrique G. Souto pedro.h.souto at gmail.com
Thu Dec 1 06:32:11 EST 2011


On 01/12/2011 08:53, Mark wrote:
> Hi there,
>
> I'm a complete beginner to Python and, aside from HTML and CSS, to coding in general. I've spent a few hours on it and think I understand most of the syntax.
>
> However, I'm wondering a bit about For Loops. I know that the basic syntax for them is to define a list, and then to use something like:
>
> for x in y
>
> However, what does "for" and "in" mean in this context? Can anyone help me to understand this? I know it's a really basic question, but hopefully it will see me on my way to coding properly :)
>
> Thanks a lot.

That means (in a free translation)

"For each one of 'x' in 'y', do this"

'y' is a list, for example, then it means: "For each one of the elements 
of the list 'y' (the element on the current iteration is named 'x'), do 
this"

Good Luck!

Att;
Pedro Henrique G. Souto
<pedro.h.souto at gmail.com>
╔═════════════╗
║ ²²²d○_○b²²² ║
╚═════════════╝




More information about the Python-list mailing list