Computer Science, asked by ajinkyadharmadhikari, 2 months ago

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))​

Answers

Answered by Japji21
0

Answer:

# If you consider:

def test(func, arg):

return func(func(arg))

def mult(x):

return x * x

print(test(mult, 2))

"""

The output is:

- consider only the argument of print() function:

- call the test() method with arguments 'mult' function reference and 2

- the test method return the result of func(func(arg)), wich is equivalent to mult(mult(2))

- from inside to outside parenthesis, mult(2) return 4, so next mult(4) return 16

- so the print() function get 16 as argument, so output is:

16

"""

Answered by swarnamanoj55
0

Answer:

16

Explanation:

Similar questions