Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #16492

Re: Complete beginner, any help appreciated :) - For Loops

Date 2011-12-01 09:32 -0200
From "Pedro Henrique G. Souto" <pedro.h.souto@gmail.com>
Subject Re: Complete beginner, any help appreciated :) - For Loops
References <5646135.332.1322736831034.JavaMail.geo-discussion-forums@prjr26>
Newsgroups comp.lang.python
Message-ID <mailman.3195.1322739143.27778.python-list@python.org> (permalink)

Show all headers | View raw


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@gmail.com>
╔═════════════╗
║ ²²²d○_○b²²² ║
╚═════════════╝

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Complete beginner, any help appreciated :) - For Loops Mark <markpackt@gmail.com> - 2011-12-01 02:53 -0800
  Re: Complete beginner, any help appreciated :) - For Loops Laurent Claessens <moky.math@gmail.com> - 2011-12-01 12:14 +0100
  Re: Complete beginner, any help appreciated :) - For Loops "Pedro Henrique G. Souto" <pedro.h.souto@gmail.com> - 2011-12-01 09:32 -0200
  Re: Complete beginner, any help appreciated :) - For Loops Dave Angel <d@davea.name> - 2011-12-01 06:56 -0500
  Re: Complete beginner, any help appreciated :) - For Loops Mark <markpackt@gmail.com> - 2011-12-01 04:15 -0800
  Re: Complete beginner, any help appreciated :) - For Loops Ben Finney <ben+python@benfinney.id.au> - 2011-12-02 00:36 +1100
  Re: Complete beginner, any help appreciated :) - For Loops "Kyle T. Jones" <onexpadREMOVE@EVOMERyahoodotyouknow.com> - 2011-12-01 18:23 -0600

csiph-web