0

Why is the comma making difference in the output?

print((lambda x: x**2 + 5*x + 4) (-4)) output:0 print((lambda x: x**2 + 5*x + 4), (-4)) output:<function <lambda> at 0×7ff8766b51f0> -4

26th Oct 2022, 9:52 AM
Shantanu
Shantanu - avatar
2 odpowiedzi
+ 4
In first , case you are calling lambda function with parameter -4 so returns -4**2 +5*-4 + 4 => 20-20 => 0 In second case, two arguments are different, no relation. First print lambda expression which returns generators, and followed by space separating -4. Note: lambda expression is a functional expression. Hope it helps..
26th Oct 2022, 10:07 AM
Jayakrishna 🇮🇳
+ 1
, means both are different expressions for print() function that's why it's printing the object of the function and -4 as integer
26th Oct 2022, 10:03 AM
Ratnapal Shende
Ratnapal Shende - avatar