[Tutor] stuck newbie
Sean 'Shaleh' Perry
shalehperry@attbi.com
Sun, 18 Aug 2002 10:17:08 -0700 (PDT)
On 18-Aug-2002 paul meaney wrote:
>
> Im a total newbie and this is my first effort at writing my own bit of code.
> The program asks for the user to enter details of soccer teams performance
> from their last six home/away games to calculate a performance score.
>
> Everything was going well to this point until I when it started skipping the
> section asking for home team and only inputs the team names and the following
> error message is generated;
>
> Traceback (most recent call last):
> File "E:\Documents and Settings\paul\Desktop\match_form.py", line 24, in ?
> while aw + ad + al != 6 :
> NameError: name 'aw' is not defined
>
> I know this will probably be a fundamental mistake, but your help and
> guidance would be appreciated,
>
is this your entire script? It looks like you simply forgot to initialize the
variables before the loop:
aw = 0
ad = 0
al = 0
while aw + ad + al != 6:
...
...
in Python the variable must exist before it can be used.