+ 1
Lambdas helpsss
why there is no comma before the (-4)? like: print((lambda x: x**2 + 5*x + 4) , (-4)) (on this lesson its like: print((lambda x: x**2 + 5*x + 4) (-4)) )
2 Respostas
+ 3
(lambda x: x**2 + 5*x + 4) creates a function, this is the equivalent of doing this:
def func(x):
return x**2 + 5*x + 4
the second part, the (-4) becomes the argument being passed to that function. it would be similar to this:
print(func(-4))
I like to see lamdbas as values, it might have been more clear to do this instead:
func = (lambda x: x**2 + 5*x + 4)
print(func(-4))
I hope this helps :)
+ 1
Thank you :)))