[Edu-sig] beginner trouble, indexing starting w/"0"

Matthew J. Moelter mmoelter@calpoly.edu
Thu, 29 Jun 2000 17:30:49 -0700

I have been following the Python edu-sig list for a while and
in the spirit of observing a "beginner" I decided to show my
dad some Python.  (He is a long-ago-retired high school math teacher
with virtually no programming experience.)

Below is how far our session got before we had "trouble":

Python 1.6a2 (#54, May  6 2000, 00:26:29)  [CW PPC w/GUSI2 w/THREADS]
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> s='Matthew'
>>> print s
>>> s
>>> len(s)
>>> s[1]
>>> s[0]

While he understood the idea of indexing fine he didn't
understand the first element being indexed with "0".
When he taught vectors or matrices to the students they usually
indexed from 1 to N (vectors), or 1 to N by 1 to M (matrices).
The upper left element in a matrix was A(1,1) or something.

If this is truly the way Python is configured it seems to me
that this could be an important stumbling block.
I do not know enough about Python myself to see if this is a
necessary approach or if it can/could be changed.  Or could it be
changed at the users option? "starting index=1" or something?


Matthew J. Moelter                    office:  (805) 756-2065
Department of Physics               email:   mmoelter@calpoly.edu
Calif Polytechnic State Univ          fax:  (805) 756-2435
San Luis Obispo, CA 93407