On Fri, Jun 11, 2010 at 09:57:34AM -0400, Ken G. wrote: > > > for j in range (0, 5): > x = a[0] # for example, 1
One picky, little point. I've seen several solutions in this thread that included something like the following: for i in range(len(mylist)): val = mylist[i] mylist[i] = f(val) o o o That works fine, but ... You can do this a bit more easily by using the "enumerate" built-in function. It provides that index. Example: for i, val in enumerate(mylist): mylist[i] = f(val) o o o See http://docs.python.org/library/functions.html#enumerate - Dave -- Dave Kuhlman http://www.rexx.com/~dkuhlman _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor