+ 2
python
What is the output of this code? def test(func, arg): return func(func(arg)) def mult(x): return x * x print(test(mult, 2))
3 Réponses
+ 3
It's a composition of functions. The value 2 is being sent through the func, mult, and the output (4 in this case) is sent into the func, mult. This output, 16, is the value returned to the print function.
+ 2
16
0
It's a quiz question I am sure.
You can check correct answers. Just scroll a bit to see "View Correct Answers"