osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

testing code



On 07/07/18 21:21, Sharan Basappa wrote:
>
> sorry. there was a copy paste error when i posted. I pasted test_2.py for both the files:
>
> here are the files again. The issue remains.
> [...]
>
> output:
> %run "D:/Projects/Initiatives/machine learning/programs/test_2_test.py"
> 30

[11:24 PM jlee at kerndev ~] $cat test_2.py
x = 10
y = 20

c = x-y

print c

def func1():
 ??? return x+y

[11:24 PM jlee at kerndev ~] $cat test_2_test.py
import test_2

x = test_2.func1()
print x
[11:24 PM jlee at kerndev ~] $python test_2_test.py
-10
30
[11:24 PM jlee at kerndev ~] $


As you can see, the? code from the import is indeed executed by the 
python interpreter.

I'm not familiar with the "%run" prefix in your command - some sort of 
windows-ism?

-Jim