newbie question (for loop)
Algis Kabaila
akabaila at pcug.org.au
Tue Mar 15 19:57:11 EDT 2011
On Wednesday 16 March 2011 05:48:14 Tim Morneau wrote:
> You have to add the colon to the end of the statement if this
> is an accurate representation of the statement so:
>
> "for i in range(len(list)):" instead of "for i in
> range(len(list))"
>
It seems to me that it would be simpler to simply do it like
this:
mylist = list
for var in mylist:
(var is an entry in the list - do with it whatever you want
to do)
The new name mylist should be used in the place where you
defined **your** list. (mylist = list is used as an indication
only; never use reserved name for a variable name - bad practice
that will lead to grief sooner or later).
OldAl.
--
Algis
http://akabaila.pcug.org.au/StructuralAnalysis.pdf
More information about the Python-list
mailing list