[Tutor] Usage of for loop

vanam raghavendra.gv.vanam at gmail.com
Mon Jan 5 14:19:47 CET 2009


Hi all,
i am beginner to this python language and slowing learning the language by
referring docs.I am trying to understand the for loop i.e., usage of for
loop in python,unlike c where i can give condition in python it is simple
iterating over sequence.

I am trying tounderstand the below lines of code but of no avail.

a = ["cat", "window","defenestrate"]
for x in a:
     print x, len(x)
i cant understand what x is doing here and what is the purpose of it
can anyone help me out here?

-- 
Raghavendra  Vanam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090105/067c856f/attachment.htm>


More information about the Tutor mailing list