Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/280.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何处理问题中的多个lambda?_Python_Lambda_Arguments - Fatal编程技术网

Python 如何处理问题中的多个lambda?

Python 如何处理问题中的多个lambda?,python,lambda,arguments,Python,Lambda,Arguments,我对如何在一个问题中处理多个lambda感到非常困惑实现lambda函数的方法之一如下: def f1(x,y,z): return x(y,z) def f2(x,y): return y(x) print(f1(lambda x,y: x+1, 2, lambda x: x**2)) 请更具体地说明你的问题。 # f1 function ''' def f1(x, y, z): return x * y * z ''' # Writing f1 function in

我对如何在一个问题中处理多个lambda感到非常困惑

实现lambda函数的方法之一如下:

def f1(x,y,z):
   return x(y,z)
def f2(x,y):
   return y(x)
print(f1(lambda x,y: x+1, 2, lambda x: x**2))

请更具体地说明你的问题。
# f1 function 
'''
def f1(x, y, z):
    return x * y * z
'''
# Writing f1 function in terms of lambda
f1 = lambda x, y, z: x * y * z

'''
def f2(x, y):
    return x * y
'''
# Writing f2 function in terms of lambda
f2 = lambda x, y: x * y

result_1 = f1(3, 5, 7)  # passing x = 3, y = 5, and z = 7 in lambda function 1
result_2 = f2(3, 5)     # passing x = 3 and y = 5 in lambda function 2

print(result_1)             # This will print 105
print(result_2)             # This will print 15
print(result_1 + result_2)  # This will print 120