<jupyter_start><jupyter_text>Week 2  Why do we use function?  built-in Functions  Review: `input()`<jupyter_code>while True:
    username = input("What's your name? ")
    if username:
        break
print(f"Welcome, {username}"")<jupyter_output><empty_output><jupyter_text>Custom functions<jupyter_code>def add(x,y):
    z = x + y
    print(z)
    
add(2,3)<jupyter_output>5<jupyter_text>`for`<jupyter_code>start = 1
stop = 11
step = 1
my_list = [1, 2, 3, 4, 5]

for i in range(1, 11, 1):
    if i == 4:
        continue
    elif i == 7:
        break
    print(i)<jupyter_output><empty_output><jupyter_text>Scope- LEGB<jupyter_code>gvar = "G"
print("hello from Global")

def a():
    avar = 'A'
    print("hello from a")
    print("local",len)

    def b():
        bvar = 'B'
        print("hello from b")
        print("enclosed",len)
    
print("global",len)<jupyter_output>hello from Global
global <built-in function len><jupyter_text>lambda<jupyter_code>square = lambda num: num ** 2
square<jupyter_output><empty_output><jupyter_text>Recursion<jupyter_code>def factorial_non_r(num):
    for i in range(1, number):
        number *= i
    
def factorial(num):
    if num == 1:
        return num
    else:
        return num * factorial(num - 1)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1375, 'fraction_numerical': 0.01796875, 'mean_word_length': 3.5913978494623655, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 24, 'https://': 0, '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': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '483911', 'license': 'MIT', 'n_tokens_mistral': 514, 'n_tokens_neox': 486, 'n_words': 107, 'path': 'learn/02week/code/.ipynb_checkpoints/lec-checkpoint.ipynb', 'repo_name': 'tmax818/nucamp_intro_python', 'size': '1280'}