0

Help!!! :(

15th May 2017, 10:41 PM
Katlyn
Katlyn - avatar
3 Respuestas
+ 3
I believe the comma in line 2 is a typo. But ignoring that: test(func, 2) # test takes two arguments, a function and an argument for the function. # in it's body it calls the function with the argument and the result of the call is passed as argument to the function again # in this case the function passed to test is mult and the argument to mult is 2 # calling mult(2) returns 2*2 = 4. So now 4 is passed to mult again by test # mult(4) returns 4*4 = 16. So 16 is the value returned from test and what is printed to the screen.
15th May 2017, 10:55 PM
Ulisses Cruz
Ulisses Cruz - avatar
0
It says what is the output of this code?:
15th May 2017, 10:42 PM
Katlyn
Katlyn - avatar
0
def test(func , arg): return func(func, (arg)) def mult(x): return x*x print(test(mult,2))
15th May 2017, 10:45 PM
Katlyn
Katlyn - avatar