Quick Problem
Lars Yencken
lljy at csse.unimelb.edu.au
Tue Apr 18 22:10:10 EDT 2006
Hello,
On Tue, 18 Apr 2006 19:05:06 -0700, continium at gmail.com wrote:
> Here is my code:
>
> cw = 0 #Computer wins total
> uw = 0 # User wins total
>
> def win(who):
> if who == 1:
> cw = cw + 1 # computer win
> elif who == 2:
> uw = uw + 1 # user win
>
Try adding into the first line of your win function:
global uw, cw
Then Python knows to look outside your function to find those variables.
Lars
More information about the Python-list
mailing list