<jupyter_start><jupyter_text>Writing Module<jupyter_code>%%writefile file1.py
def myfunc(x):
    return [num for num in range(x) if num%2==0]
list1 = myfunc(21)    
%%writefile file2.py
import file1
file1.list1.append(1000)
print(file1.list1)
! python file2.py
import file1
print(file1.list1)<jupyter_output>[0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20]<jupyter_text>Passing cmd line arg<jupyter_code>%%writefile file3.py
import sys
import file1
num  = int(sys.argv[1])
print(file1.myfunc(num))

! python file3.py 45<jupyter_output>[0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44]<jupyter_text>__name__ == "__main__"<jupyter_code>! python own_module/fileone.py<jupyter_output>Top level print inside fileone.py
if con<jupyter_text>Decorate Function<jupyter_code>def func():
    return 3

func()
def hello(name="Vijay"):
    return 'Hello'+name
hello('Ram')
greeting = hello
hello
greeting
del hello
greeting
hello<jupyter_output><empty_output><jupyter_text>Functions within functions<jupyter_code>def hello(name = 'vijay'):
    print("This is hello() function getting executed "+name)
    
    def hi():
        return "\t This is inside hi() method"
    def hola():
        return " \t This is inside the hola() function"
    print(hi())
    print(hola())
    print("print everything this function")
    
say = hello(name = 'ram')<jupyter_output>This is hello() function getting executed ram
	 This is inside hi() method
 	 This is inside the hola() function
print everything this function<jupyter_text>Returning Function<jupyter_code>def hello(name = 'vijay'):
    
    def hi():
        return "\t This is inside hi() method"
    def hola():
        return " \t This is inside the hola() function"
    if name == 'vijay':
        return hi
    else:
        return hola
    
say = hello(name='ram')
def hello():
    return "Hi vanakam"

def other_func(func):
    print('Other function')
    print(func)
    print(func())
other_func(hello)
def new_d(fun):
    
    def wrap_func():
        print("Code which you would like to execute before ")
        
        func()
        
        print("Code here wil be executed after the func()")
        
    return wrap_func    
def fun_which_needs_decorator():
    print("""this is the fucntion which need of decorator""")
fun_which_needs_decorator()
fun_which_needs_decorator = new_d(fun_which_needs_decorator)
fun_which_needs_decorator()
@new_d
def my_fun_which_will_get_decorated():
    print("This is the new function which will get decorate")
my_fun_which_will_get_decorated()<jupyter_output>Code which you would like to execute before 
Code here wil be executed after the func()
{'fraction_non_alphanumeric': 0.11461856444945509, 'fraction_numerical': 0.03231867718902668, 'mean_word_length': 4.041666666666667, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '174056', 'license': 'MIT', 'n_tokens_mistral': 1007, 'n_tokens_neox': 923, 'n_words': 268, 'path': 'Modules and Packages.ipynb', 'repo_name': 'ramsvijay/basic_datatype_python', 'size': '2661'}