Elementry question on indeces

Ken Seehof kens at sightreader.com
Sun Mar 5 22:13:09 CET 2000

Think about these questions and all will be very clear.

"You have a 5 inch piece of string.  You want to cut it into one inch
pieces.  How many times to you cut the string?"

"Has the new millenium started yet or not?"

"Why is this the 21st century when it starts with 20?"

"How many integers are there between 50 and 100?"

Rick wrote:

> From the tutorial, on strings and zero relative indeces,
> where word =
> 'HelpA'.
> I have no problem with this, we are asking for 4th entry:
> >>> word[4]
> 'A'
> but it seems to me the following is asking for the 0th, 1th and 2th entries
> (ordinal 1st ,2nd and 3rd) but all we are getting is the zero-th and one-th.
> >>> word[0:2]
> 'He'
> What am I missing here?  Makes me feel like I've been taking stupid pills.
> Thanks,
> Rick
> --
> Yale beat Harvard

More information about the Python-list mailing list