I have a simple python script (say, simple.py) , like
a = 5
b = a + a
print(b)
But I want the following: output the result as if these commands were executed in the interpreter, like
>>> a = 5
>>> b = a + a
>>> print(b)
10
And I want this in stdout :) Is that possible in some simple way? Also the same question for IPython. This question can be helpful for writing a small "how-to" for working with Python/IPython interpreters