14th Sep 2020, 9:59 AM
Satyam Mishra
Satyam Mishra - avatar
2 Antworten
+ 3
First, the add_five function just takes a value and adds 5 to it. Then, the apply_twice function executes the function provided twice. If you pass the add_five function to the apply_twice function, func becomes add_five, so it become: return add_five(add_five(10)) Which simplifies into: return add_five(15) And then into: return 20 Hope this helps.
14th Sep 2020, 10:02 AM
Rowsej
Rowsej - avatar
+ 3
return func(func(arg)) This line is simply replaced with, return add_five(add_five(10)) So add_five(10) returns 15 Now return add_five(15) which will return 15+5=20
14th Sep 2020, 10:03 AM
Avinesh
Avinesh - avatar