So I have a piece of code such as
def math():
x = 2
y = 4
z = x + y
What I'd like to be able to do is print out the contents of this function somehow, so that what appears in the output window is:
x = 2
y = 4
z = x + y
How could I print this out as a string from the function?
I tried things such as:
print(math())
but that just calls the function or
print(math)
which doesn't give my anything. And
print("math()")
just prints out the name.