Errors
Stidolph, David
stidolph at origin.ea.com
Fri Apr 30 09:33:26 EDT 1999
try this...
tally = 0
for word in All_Words:
z = 0
while z < len(word):
if z == 0:
tally = tally + alpha.index(word[z])
else:
tally = tally + (alpha.index(word[z]) * 26)
The right side of the '=' is being done before the left, so you are trying
to read a variable that has not been initialized.
-----Original Message-----
From: smoothasice at geocities.com [mailto:smoothasice at geocities.com]
Sent: Thursday, April 29, 1999 4:17 PM
To: python-list at cwi.nl
Subject: Errors
Ok I have been using python and I have noticed that the errors aren't
truly helpful.. I don't know if I just didn't learn this properly but I
dont' know why this generates an error:
for word in All_Words:
z = 0
while z < len(word):
if z == 0:
tally = tally + alpha.index(word[z])
else:
tally = tally + (alpha.index(word[z]) * 26)
It gives me this: NameError: tally
and I don't know why......
THanks,
Anton
More information about the Python-list
mailing list