<jupyter_start><jupyter_text>Writing a Module<jupyter_code>%%writefile fileModule.py
def myfunc(x):
    return [num for num in range(x) if num%2 == 0]
list1 = myfunc(43)
%%writefile fileModuleExec.py
import fileModule
fileModule.list1.append(100)
print(fileModule.list1)
! python fileModuleExec.py
import fileModule
print(fileModule.list1)<jupyter_output>[0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42]<jupyter_text>Passing command line arguments<jupyter_code>%%writefile fileModPassArg.py
def myfunc(x):
    return [num for num in range(x) if num%2 == 0]
list1 = myfunc(43)
%%writefile fileModPassArgCall.py
import sys
import fileModPassArg
num = int(sys.argv[1])
print(fileModPassArg(num))
! python fileModPassArgCall.py 25<jupyter_output>Traceback (most recent call last):
  File "fileModPassArgCall.py", line 4, in <module>
    print(fileModPassArg(num))
TypeError: 'module' object is not callable<jupyter_text>Packages name == "__main__"<jupyter_code>! python fileone.py
! python filetwo.py<jupyter_output>top level pring inside fileone.py
fileone.py is being imported into another module
Top level in filetwo.py
 function running in fileone.py
filetwo.py is being executed direclty
StarcoderdataJupyterStructuredCleanDedup