Why Don't Return?

Tommy Grav tgrav at mac.com
Mon Dec 3 15:14:03 EST 2007


def a():
    d = b()
    print d

def b()
    c = "Hi"
    return c

if __name__ == "__main__":
    a()

Cheers
   TG

On Dec 3, 2007, at 3:05 PM, Victor Subervi wrote:

> Hi;
> Here is sample function:
>
> def a():
>   b()
>   print c
>
> def b():
>   c = "Hi"
>   return c
>
> if __name__ == "__main__":
>   a()
>
> then run a(). Throws error about c not being defined. How do I  
> return c from b?
> TIA,
> Victor
> -- 
> http://mail.python.org/mailman/listinfo/python-list




More information about the Python-list mailing list