Hi all, After a rather long (and unfortunate) break from tinkering with Python, I am back at it. I am working through the book Learning Python (based on 2.2/2.3 - I use 2.5), and in the chapter on while/for loops, ran across the following example:
>>> L = [1, 2, 3, 4, 5] >>> for i in range(len(L)): ... L[1] += 1 # this is a typo I made - should have been L[i], not L[1]. ... >>> L [1, 7, 3, 4, 5] I did correct my typo, but what I do not understand is how range arrived at a '7', where the '2' should be. My best guess is that L[1] is treated as the index of the value '2'. I hope that learning how my error affected the result will help me grasp the concept a little better. Thanks! Don -- D.C. Parris Minister, Journalist, Free Software Advocate https://www.xing.com/profile/Don_Parris http://www.linkedin.com/in/dcparris sip:[EMAIL PROTECTED] <[EMAIL PROTECTED]>
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor