def apply_twice(func, arg):
return (func(arg)) # argument is 10 ,that added to to value 5
def add_five(x): # func when called once add_five inside becomes 10+5=15
return x + 5
print(apply_twice(add_five, 10))
def apply_twice(func, arg):
return func(func(arg)) # argument is 10 ,that added to to value 5 now called twice
def add_five(x):# func when called twice add_five inside becomes 10+5+5=20
return x + 5
print(apply_twice(add_five, 10))
def apply_twice(func, arg):
return func(func(arg))+ func(func(arg))# argument is 10 ,that added to to value 5 now called twice
def add_five(x): # two time repeated func , when called twice add_five inside becomes 10+5+5=20 +20=40
return x + 5
print(apply_twice(add_five, 10))