Errors

Jeremy Hylton jeremy at cnri.reston.va.us
Thu Apr 29 18:57:19 EDT 1999


You need to initialize tally first.  You're getting a NameError
because the first reference to tally is on the right hand side of the
first assignment.  Python is looking up tally and not finding it,
because you haven't assigned to it yet.

>>> tally = tally + 1
Traceback (innermost last):
  File "<stdin>", line 1, in ?
NameError: tally

vs.

>>> tally = 0
>>> tally = tally + 1

Jeremy




More information about the Python-list mailing list