wasm-demo/demo/ermis-f/python_m/cur/1256

40 lines
1.1 KiB
Plaintext

From: wtanksle at dolphin.openprojects.net (William Tanksley)
Date: Thu, 29 Apr 1999 23:22:51 GMT
Subject: Errors
References: <3728CD26.907ED9A1@geocities.com>
Message-ID: <slrn7ihqeb.dk7.wtanksle@dolphin.openprojects.net>
X-UID: 1256
On Thu, 29 Apr 1999 21:16:50 GMT, smoothasice at geocities.com wrote:
>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:
The errors could certainly be improved, couldn't they?
>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......
This one's not too hard -- look at 'tally'. What is its starting value?
You're trying to use a variable which has no value. Try setting it to
zero somewhere.
>Anton
--
-William "Billy" Tanksley
"But you shall not escape my iambics."
-- Gaius Valerius Catullus