A two-parameter lambda function raising its first parameter to the power of the second parameter should be declared as:
A two-parameter lambda function raising its first parameter to the power of the second parameter should be declared as:
A lambda function in Python is declared using the syntax `lambda parameters: expression`. In this case, to raise the first parameter to the power of the second parameter, the correct declaration is `lambda x, y: x ** y`.
D. lambda x, y: x ** y
D is the correct answer. d = lambda x,y:x**y print (d(2,3)) ====================== RESTART: C:\xxxxxxn.py ===================== 8 >>>
Correct: >>> lambda x,y:x**y <function <lambda> at 0x0000027F6788C268> >>> lambda(x,y)=x**y File "<stdin>", line 1 lambda(x,y)=x**y ^ SyntaxError: invalid syntax >>> def lambda(x,y): return x**y File "<stdin>", line 1 def lambda(x,y): return x**y ^ SyntaxError: invalid syntax
You have to use it like below - d = lambda x,y:x**y print (d(2,3))