Explanation:
lambda a, b: a + b + 1 is an anonymous function that takes two inputs, a and b.
-
It returns the result of a + b + 1.
Now, let's call this function with a = 7 and b = 2:
So, print(sum_nums(7, 2)) will output:
Why the +1?
It’s just part of the function's definition — maybe to always add 1 as a bonus or offset.
Let me know if you want to see how this compares to a regular function definition too.


0 Comments:
Post a Comment