Complete beginner, any help appreciated :) - For Loops

Kyle T. Jones onexpadREMOVE at EVOMERyahoodotyouknow.com
Thu Dec 1 19:23:22 EST 2011


On 12/1/11 4:53 AM, 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.

y is some list ["help","beginner","question"]

for x in y:
	if x=="question": print "FOUND"


Clear?

Cheers.



More information about the Python-list mailing list