+ 2

def square (x): return x*x def test(func,x): print(func(x)) test (square,42)

if i want output so what it will be for test

6th May 2018, 4:10 PM
Rohit Singh
Rohit Singh - avatar
3 Answers
+ 24
You can use the code playground to test outputs... test(square, 42) will send a function (square) and x (42) to test function test function prints the value returned from square i.e passes 42 to square function which will be multiplied later square returns multiplication of the two i.e 42*42 = 1764 which is printed
6th May 2018, 4:25 PM
Frost
Frost - avatar
+ 2
def square(x): return x * x def test(func, x): print(func(x)) test(square, 42)
2nd Aug 2019, 7:51 AM
GYANENDRA PAL SINGH
GYANENDRA PAL SINGH - avatar
0
wtf
1st May 2019, 9:35 PM
Harman Singh
Harman Singh - avatar