Python - output from functions?

Posted by Seafoid on Stack Overflow See other posts from Stack Overflow or by Seafoid
Published on 2010-06-16T11:27:05Z Indexed on 2010/06/16 11:32 UTC
Read the original article Hit count: 178

Filed under:
|
|
|

Hi

I have a very rudimentary question.

Assume I call a function, e.g.,

def foo():
    x = 'hello world'

How do I get the function to return x in such a way that I can use it as the input for another function or use the variable within the body of a program?

When I use return and call the variable within another functions I get a NameError.

Thanks, S :-)

© Stack Overflow or respective owner

Related posts about python

Related posts about beginner