Beginnger Question

Ü spw105 at york.ac.yk
Wed Apr 10 20:26:28 EDT 2002


> > >x = 2
> > >def wrong(num):
> > >    x = x+1
> > >    print x
>
> No, this should be
>
> def incx():
>   global x
>   x = x+1
>
> x = 2
> incx()
> print x
> # prints 3

Yup, I see where I went wrong now, but that *was* exactly what I was aiming
to do, at least... hehe





More information about the Python-list mailing list