0
Where did the output 16 come from?
def fun1(func, arg): return func(func(arg)) def fun2(x): return x*x print(fun1(fun2, 2))
4 Réponses
+ 3
That code won't run for me as is, but if the 2nd line of fun1 was instead like this:
def fun1(func, arg):
return func(func(arg))
then 16 is because
fun1(fun2, 2)
fun2(fun2(2))
fun2(4)
16
+ 3
calling fun1(fun2,2) returns fun2(fun2(2)) which evaluates as follows:
fun2(2*2) as fun2(x)=x*x
fun2(4)
finally 4*4
hence 16
+ 2
2×2=4
4×4=16
+ 1
yeah the code is like what u type potto.. sorry my bad