Beginnger Question

¨ simon at piranhaflt.freeserve.co.uk
Tue Apr 9 11:20:32 EDT 2002


Matthew Baulch <matt at greenroom.com.au> wrote in message
news:3CB3039C.3040108 at greenroom.com.au...
> I think the code you are looking for could be:
>
> x = 2
>
> def wrong(num):
>    return num + 1
>
> x = wrong(x)
> print x
>
> x = wrong(x)
> print x
>

I'm a newbie myself, so this is probably wrong, but wouldn't this be *even*
better?

x = 2
def wrong(num):
    x = x+1
    print x

wrong(x)
wrong(x)





More information about the Python-list mailing list