+ 1

Output is 16 but how ??? Anyone can explain

def test(func,arg): return func (func (arg)) def mult(x): return x * x print(test(mult,2))

15th Aug 2020, 6:52 PM
Sagar Kumar
Sagar Kumar - avatar
5 Respostas
+ 1
Passing function as argument.. So just replace func with mult and check... return func( func(arg)) => mult(mult(2) =>mult(4) =>16
15th Aug 2020, 6:59 PM
Jayakrishna 🇮🇳
+ 1
Thanks a ton sir
15th Aug 2020, 7:02 PM
Sagar Kumar
Sagar Kumar - avatar
+ 1
Sorry sir
15th Aug 2020, 7:07 PM
Sagar Kumar
Sagar Kumar - avatar
0
Sagar Kumar you're welcome.. Edit:
15th Aug 2020, 7:06 PM
Jayakrishna 🇮🇳
0
Sagar Kumar no problem..
15th Aug 2020, 7:08 PM
Jayakrishna 🇮🇳