0
Can anybody explain this function to me?
Can anyone explain to me this coding function? def apply_twice(func, arg): return func(func(arg)) def add_five(x): return x + 5 print(apply_twice(add_five, 10)) Output is 20 Thank you in advance!!
2 Respostas
+ 2
1.) add_five does 10 + 5 -> 15
2.) apply_twice repeats 1.): 15 + 5 -> 20
0
apply_twice(add_five,10)) = add_five(add_five(10)) = add_five(15) = 20