<jupyter_start><jupyter_text>function def function(parameter):        실행문1    실행문2    ...    return output  function with input and out put<jupyter_code>def awe_sum(a,b):
    result=a+b
    return result

a=2
b=3
print(awe_sum(a,b))<jupyter_output><empty_output><jupyter_text>function without input<jupyter_code>def print_hello():
    return "hello"

print_hello()<jupyter_output><empty_output><jupyter_text>function without return<jupyter_code>def func_wo_return(a):
    print("This is function without return for "+str(a)+"times")
    
func_wo_return<jupyter_output><empty_output><jupyter_text>function with multiple return<jupyter_code>def mul_return(a):
    b= a+1
        return a,b<jupyter_output><empty_output><jupyter_text>return skill<jupyter_code>def id_check(id):
    if id == "admin":
        print("invalid id: admin")
        return
    print("valid id: ", id)
id_check("admin")<jupyter_output><empty_output><jupyter_text>parameter with initialize<jupyter_code>def say_hello(name="Fool", nick=True):
    print("Hi,",name)
    if nick== True:
        print("But, you are Fool")
    else:
        print("Oh, you are not Fool")
"""
say_hello(fool,true)
"""
say_hello("Fool", True)
"""
say_hello("Smart",False)
"""
say_hello("Smart", False)
def pass_req(Toeic):
    print("Your Toeic is",Toeic)
    if Toeic >= 900:
        print ("You are hired.")
    else:
        print("Ooops, you have to study hard")
        
pass_req(900)
pass_req(850)<jupyter_output>Your Toeic is 900
You are hired.
Your Toeic is 850
Ooops, you have to study hard<jupyter_text>arguments<jupyter_code>def mul_sum(*args): #### what is this??
    sum=0
    for i in args:
        sum += i
    return sum
mul_sum(10)<jupyter_output><empty_output><jupyter_text>keyword argument<jupyter_code>def kwargs_url(server,port,**query):
    url="https://"+server+":"+port+"?"
    for key in query.keys():
        url+= key +"="+query[key]+"&"
    return url
kwargs_url(server,port,**query) #### i dont remember query<jupyter_output><empty_output><jupyter_text>variable outside function<jupyter_code>a="hello"
def glob_test(a):
    a += "world"
    return a
glob_test(a)
print(a)

a="hello"
def glo_text(x):
    x+="world"
    return x
glob_test(a)
print(a)<jupyter_output>hello
hello<jupyter_text>variable outside function<jupyter_code>def glob_test2(x):
    a +="world"
    x +="success"
    return x
glob_test2(a)<jupyter_output><empty_output><jupyter_text>So, how to globalize? (1) using return<jupyter_code>a='hello'
def glob_test(a):
    a += "world"
    return a
a= glob_test(a)
print(a)<jupyter_output>helloworld<jupyter_text>(2) use global<jupyter_code>a="hello"
def glob_test(a):
    global a
    a+="world"
    return a
glob_test(a)
print(a)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14098837209302326, 'fraction_numerical': 0.009811046511627907, 'mean_word_length': 5.037280701754386, 'pattern_counts': {'":': 2, '<': 46, '<?xml version=': 0, '>': 47, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '12', 'dir': 'jupyter-structured-clean-dedup', 'id': '157850', 'license': 'MIT', 'n_tokens_mistral': 1071, 'n_tokens_neox': 1059, 'n_words': 205, 'path': 'python/function_practice.ipynb', 'repo_name': 'MinJiH/TIL', 'size': '2752'}