Multi functions working in python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Multi functions working in python

Why these two aren't same def mul(a,b,c): return a*b*c def add(b,a,c): return a+b-c def doub(lol,pol,a,b,c): return (lol(a,b,c)) + (pol(a,b,c)) print(doub(mul,add,5,7,8)) def mul(a,b,c): return a*b*c def add(b,q,c): return a+b-c def doub(lol(a,b,c),pol(a,b,c): return lol(a,b,c) + pol(a,b,c) print(doub(mul(5,7,8),add(5,7,8)))

14th Apr 2022, 9:03 AM
Umar Farooq
2 Answers
+ 2
Because this syntax is wrong doub(lol(a, b, c), pol(a, b, c)): you can pass function as an argument but cannot pass with parameters
14th Apr 2022, 9:23 AM
A͢J
A͢J - avatar
0
This means if you want to pass two functions in a single function they both must have same arguments?
14th Apr 2022, 6:55 PM
Umar Farooq