which a is used?

Dwight Hutto dwightdhutto at gmail.com
Mon Sep 24 19:57:27 EDT 2012


On Mon, Sep 24, 2012 at 7:43 PM, Jayden <jayden.shui at gmail.com> wrote:
> Dear All,
>
> I have a simple code as follows:
>
> # Begin
> a = 1
>
> def f():
>     print a
>
> def g():
>     a = 20
>     f()
>
> g()
> #End
>
> I think the results should be 20, but it is 1. Would you please tell me why?
>
> Thanks a lot!
>
> --
> http://mail.python.org/mailman/listinfo/python-list

didn't return the value, or print it out


-- 
Best Regards,
David Hutto
CEO: http://www.hitwebdevelopment.com



More information about the Python-list mailing list