Let’s break this code step by step:
๐ Explanation:
-
x = 5
→ Assigns integer 5 to variable x. -
(lambda z: z**2)
→ This is an anonymous function (created using lambda).
It takes one argument z and returns z**2 (square of z).Equivalent to:
-
(lambda z: z**2)(x)
→ The lambda function is immediately called with the argument x (which is 5).
→ So it computes 5**2 = 25. -
y = (lambda z: z**2)(x)
→ The result 25 is stored in y. -
print(y)
→ Prints 25.


0 Comments:
Post a Comment