human
I am working on the file "Section 2 - Advance Python/Chapter S2.01 - Functional Programming/01.01_Functions_as_First_Class_citizens.ipynb".
The first task is:
??? why code
Can you write Python code for it?
 Give me a the Python code you requested?
assistant
#Here is the Python code you requested.

def test():
    print("TESTTESTTEST")
    def yes(name):
        print("Ja, ", name)
        return True
    return yes

d = test()
print("XSSSS")
print(d("Venky"))

def power(exp):
    def subfunc(a):
        return a**exp
    return subfunc

square = power(2)
hexa = power(6)

print(square)
print(hexa)

print(square(5)) # 5**2
print()
print(hexa(3)) # 3**6
print(power(6)(3))
# subfunc(3) where exp = 6
# SQuare 

# exp -> 2 
# Square(5) 
# a -> 5 
# 5**2
# 25

 Power(6)(3, x)

def a1(m):
    x = m * 2
    def b(v, t=None):
        if t:
            print(x, m, t)
            return v + t
        else:
            print(x, m, v)
            return v + x
    return b
n = a1(2)
print(n(3))
print(n(3, 10))

def f1(a):
    def f2(b):
        return f2
        def f3(c):
            return f3
            def f4(d):
                return f4
                def f5(e):
                    return f5
print (f1(1)(2)(3)(4)(5)) 

def f1(a):
    def f2(b):
        def f3(c):
            def f4(d):
                def f5(e):
                    print(e)
                return f5
            return f4
        return f3
    return f2
        
f1(1)(2)(3)(4)(5)