def compose(proc1, proc2):
def wrapper(x):
return proc2(proc1(x))
return wrapper
def double(x):
return x * 2
def square(x):
return x * x
doubleThenSquare = compose(double, square)
squareThenDouble = compose(square, double)
print(doubleThenSquare(5))
print(squareThenDouble(5))
To embed this project on your website, copy the following code and paste it into your website's HTML: