def apply_twice(func, arg): return func(func(arg)) def add_five(x): return x + 6 print(apply_twice(add_five, 11)) Why output is 23? It should be 22.
The control flow is something like this- 1. add_five receives 11 and add_five. 2. It has return statement with branched function call. func(func(arg)) = func(17) (it adds 6 to 11) func(17) = 23 (it adds 6 to 17)
Why would you call a function that adds 6 "add_five"? Variable names should help the readers not confuse them 🙃
David Ashton à la SL quiz. :>
Hatsy Rei Hmm Jash's question is the same as https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2459/ first lesson except there add_five() returns x + 5 and the argument is 10 not 11. I couldn't find the quiz (?)
Everyone don't work as per their names. It's name is add_five but it actually adds 6.😜😀😀 Just like Kushboo naam ki ladki bhi badbu lagti hai 😜😂😂😎