[Tutor] UnboundLocalError and Break

Luke Paireepinart rabidpoobear at gmail.com
Thu Oct 1 04:12:25 CEST 2009

You're using a global variable (playHP) in a function, but you haven't told
the function that playHP is supposed to be a global variable.You're going to
want to change your function definition to:

def monsAttk (damage, attack): #A monsters attack
*    global playHP*

On Wed, Sep 30, 2009 at 9:13 PM, bob gailer <bgailer at gmail.com> wrote:
> Something is screwy.
> def monsAttk (damage, attack,playHp): # function expects 3 arguments
> monsAttk(4, 15) # passes 2 arguments
> That should raise TypeError: monsAttk() takes exactly 3 argument (2 given)
> So something else is awry.

That's because Corey originally e-mailed code that he had already modified
rather than the code that was generating the error.  The pastebin code is

Corey, I'm not trying to be an ass, but you're making it difficult for us to
help you and thus we're less inclined to.

On Wed, Sep 30, 2009 at 9:00 PM, Corey Richardson <kb1pkl at aim.com> wrote:

>  Luke Paireepinart wrote:
> If your code's more than 10 lines long or so,  put it on pastebin.com and
> send us the link rather than inlining the whole thing.  You could also send
> it as an attachment.
> Your formatting is all screwed up and I can't read the code at all, but I
> have an idea about your error.
> Hmmm...thats odd. I didn't do anything different....but I can do that.
> http://pastebin.com/m518f612f
>    <http://mail.python.org/mailman/listinfo/tutor>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090930/de6550fa/attachment.htm>

More information about the Tutor mailing list