[Tutor] HELP!!!!!

Alan Gauld alan.gauld at btinternet.com
Thu Apr 17 18:51:04 CEST 2008

"Michael Kim" <kimgaang at aol.com> wrote

> Hi I am having a really hard time making my tictactoe program work. 
> I
> was wondering if you could could check it out and help me with the
> error.  Thanks

Like to give us a clue as to what the error is?
And include the error message if there is one please.

However, at a quick glance:

> def pieces():
>    whosefirst=askquestion("Do you want to go first? (y/n): ")
>    if whosefirst == "y":
>        human = X

I would expect that to fail since you haven't defined the
variable X yet. You need to put the line below above
the assignment...

>        X="X"
>        computer = O
>        O="O"
>    else:
>        computer = X
>        human = O

Similarly here, X and O are not defined anywhere.

This is as far
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauldas I read...

More information about the Tutor mailing list