What is the output of the following program :y = 8z = lambda x : x * yprint z(6)
Question
What is the output of the following program :y = 8z = lambda x : x * yprint z(6)
Solution
The output of the program will be 48.
Here's the step by step explanation:
- The variable
yis assigned the value 8. - A lambda function is created which takes one argument
xand returns the product ofxandy. - The lambda function (stored in variable
z) is called with the argument 6. - The function multiplies 6 (the argument passed) and
Similar Questions
What is the output of the following code snippet?exp = lambda x: x % 3print(exp(2))
What will be the output of the following program:r = lambda q: q * 2s = lambda q: q * 3x = 2x = r(x)x = s(x)x = r(x)print (x)
What is the output of the following code snippet?x = 3y = 2print(x ** y)
x = 462231238978z = 2c = x ^ x * z // 2print(c)what will be the output of this python code
What will be the output of the following Python code?L = [lambda x: x ** 2, lambda x: x ** 3, lambda x: x ** 4] for f in L: print(f(3)) 2781343 6912 92781 None of the mentioned
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.