Re: simple beginner question about lists and negative index

2008-05-03 Thread dwblas
On May 1, 10:04 am, "Terry Reedy" <[EMAIL PROTECTED]> wrote: > "jmDesktop" <[EMAIL PROTECTED]> wrote in message > | > | s = 'abcde' > | i = -1 > | for i in range (-1, -len(s), -1): > |print s[:i], i > | Why doesn't the first one have the e if -1 is the end of the list? That should be obvious.

Re: simple beginner question about lists and negative index

2008-05-01 Thread Terry Reedy
"jmDesktop" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | This program: | | s = 'abcde' | i = -1 | for i in range (-1, -len(s), -1): |print s[:i], i | | gives | | abcd -1 | abc -2 | ab -3 | a -4 | | Why doesn't the first one have the e if -1 is the end of the list? In | Dive

Re: simple beginner question about lists and negative index

2008-05-01 Thread jmDesktop
On May 1, 10:59 am, jmDesktop <[EMAIL PROTECTED]> wrote: > This program: > > s = 'abcde' > i = -1 > for i in range (-1, -len(s), -1): >     print s[:i], i > > gives > > abcd -1 > abc -2 > ab -3 > a -4 > > Why doesn't the first one have the e if -1 is the end of the list?  In > Dive Into Python it s

simple beginner question about lists and negative index

2008-05-01 Thread jmDesktop
This program: s = 'abcde' i = -1 for i in range (-1, -len(s), -1): print s[:i], i gives abcd -1 abc -2 ab -3 a -4 Why doesn't the first one have the e if -1 is the end of the list? In Dive Into Python it said that -1 was the end of the list. Thanks. it is from Chun's book, slightly modif