[Tutor] stuck newbie

paul meaney paul@meaney.cjb.net
Sun, 18 Aug 2002 17:27:33 +0100


This is a multi-part message in MIME format.

------=_NextPart_000_0007_01C246DC.89C6ECE0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable


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;=20

Traceback (most recent call last):
  File "E:\Documents and Settings\paul\Desktop\match_form.py", line 24, =
in ?
    while aw + ad + al !=3D 6 :
NameError: name 'aw' is not defined

I know this will probably be a fundamental mistake, but your help and =
guidance would be appreciated,

Paul

#enter home team details

print "Please enter home team details"
home_team =3D raw_input ("Enter home team: ")

#check that no more than 6 results are entered

while hw + hd + hl !=3D 6 :
    hw =3D input ("Enter number home teams no. of home wins out of last =
six games 6: ")
    hd =3D input ("Enter number home teams no. of home draws out of last =
six games 6: ")
    hl =3D input ("Enter number home teams no. of home defeats out of =
last six games 6: ")
   =20
    if hw + hd + hl > 6: print "These figures come to more than six =
games this system works on the form of the last six games only"
    if hw + hd + hl < 6: print "These figures come to less than six =
games this system works on the form of the last six games only"=20
    else:
        print "Please enter away team details"


#enter away team details

away_team =3D raw_input ("Enter away team: ")

#check that no more than 6 results are entered


while aw + ad + al !=3D 6 :
    aw =3D input ("Enter number away teams no. of away wins out of last =
six games 6: ")
    ad =3D input ("Enter number away teams no. of away draws out of last =
six games 6: ")
    al =3D input ("Enter number away teams no. of away defeats out of =
last six games 6: ")
    if aw + ad + al > 6: print "These figures come to more than six =
games this system works on the form of the last six games only"
    if aw + ad + al < 6: print "These figures come to less than six =
games this system works on the form of the last six games only"=20

#calculate probability of each team winning



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.381 / Virus Database: 214 - Release Date: 02/08/2002

------=_NextPart_000_0007_01C246DC.89C6ECE0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Im a total newbie and this is my first =
effort at=20
writing my own bit of code. The program asks for the user to enter =
details of=20
soccer teams performance from their last six home/away games to =
calculate a=20
performance score.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Everything was going well to this point =
until I=20
when it started skipping the section asking for home team and only =
inputs the=20
team names and the following error message is generated; </FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Traceback (most recent call =
last):<BR>&nbsp; File=20
"E:\Documents and Settings\paul\Desktop\match_form.py", line 24, in=20
?<BR>&nbsp;&nbsp;&nbsp; while aw + ad + al !=3D 6 :<BR>NameError: name =
'aw' is not=20
defined</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I know this will probably be a =
fundamental mistake,=20
but your help and guidance would be appreciated,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Paul</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>#enter home team details</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>print "Please enter home team =
details"<BR>home_team=20
=3D raw_input ("Enter home team: ")</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>#check that no more than 6 results are=20
entered</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>while hw + hd + hl !=3D 6 =
:<BR>&nbsp;&nbsp;&nbsp; hw=20
=3D input ("Enter number home teams no. of home wins out of last six =
games 6:=20
")<BR>&nbsp;&nbsp;&nbsp; hd =3D input ("Enter number home teams no. of =
home draws=20
out of last six games 6: ")<BR>&nbsp;&nbsp;&nbsp; hl =3D input ("Enter =
number home=20
teams no. of home defeats out of last six games 6: =
")<BR>&nbsp;&nbsp;&nbsp;=20
<BR>&nbsp;&nbsp;&nbsp; if hw + hd + hl &gt; 6: print "These figures come =
to more=20
than six games this system works on the form of the last six games=20
only"<BR>&nbsp;&nbsp;&nbsp; if hw + hd + hl &lt; 6: print "These figures =
come to=20
less than six games this system works on the form of the last six games =
only"=20
<BR>&nbsp;&nbsp;&nbsp; =
else:<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print=20
"Please enter away team details"</FONT></DIV>
<DIV>&nbsp;</DIV><FONT face=3DArial size=3D2>
<DIV><BR>#enter away team details</DIV>
<DIV>&nbsp;</DIV>
<DIV>away_team =3D raw_input ("Enter away team: ")</DIV>
<DIV>&nbsp;</DIV>
<DIV>#check that no more than 6 results are entered</DIV>
<DIV>&nbsp;</DIV>
<DIV><BR>while aw + ad + al !=3D 6 :<BR>&nbsp;&nbsp;&nbsp; aw =3D input =
("Enter=20
number away teams no. of away wins out of last six games 6:=20
")<BR>&nbsp;&nbsp;&nbsp; ad =3D input ("Enter number away teams no. of =
away draws=20
out of last six games 6: ")<BR>&nbsp;&nbsp;&nbsp; al =3D input ("Enter =
number away=20
teams no. of away defeats out of last six games 6: =
")<BR>&nbsp;&nbsp;&nbsp; if=20
aw + ad + al &gt; 6: print "These figures come to more than six games =
this=20
system works on the form of the last six games =
only"<BR>&nbsp;&nbsp;&nbsp; if aw=20
+ ad + al &lt; 6: print "These figures come to less than six games this =
system=20
works on the form of the last six games only" </DIV>
<DIV>&nbsp;</DIV>
<DIV>#calculate probability of each team winning</FONT></DIV><FONT =
face=3DArial=20
size=3D2>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><BR>---<BR>Outgoing mail is certified Virus Free.<BR>Checked by AVG =

anti-virus system (<A=20
href=3D"http://www.grisoft.com">http://www.grisoft.com</A>).<BR>Version: =
6.0.381 /=20
Virus Database: 214 - Release Date: =
02/08/2002</FONT></DIV></BODY></HTML>

------=_NextPart_000_0007_01C246DC.89C6ECE0--