- 1

What are the problems in these codes?

def multi(a,b): return a*b def t(z,a,b): return z(z(a,b)) c=4 d=5 print(t(multi,c,d))

16th Mar 2021, 8:30 AM
Nafi Rahat Rahman
2 Antworten
+ 1
'multi' function expect two arguments, but outer call of 'z' ('multi') inside 't' function only use one (return value of z(a,b)) ^^
16th Mar 2021, 8:40 AM
visph
visph - avatar
+ 1
return z(z(a, b)) This line contains the error. Notice first z() function takes two input but second z() function takes one. And you pass multi() function which doesn't handle variable parameters. So you need to fix that.
16th Mar 2021, 8:44 AM
Abir Hasan
Abir Hasan - avatar