def test(a,b,fn):
c = fn(a,b)
return c
def add(x,y):
z = x + y
return z
def minus(x,y):
z = x - y
return z
def multi(x,y):
z = x * y
return z
def divi(x,y):
z = x / y
return z
print(test(2,3,add))
print(test(2,3,minus))
print(test(2,3,multi))
print(test(2,3,divi))
Python: Examples of callback functions
Guess you like
Origin blog.csdn.net/weixin_42161670/article/details/112118336
Recommended
Ranking