Mario S
0
Q:

if in lambda function python

lambda <arguments> : <Return Value if condition is True> if <condition> else <Return Value if condition is False>
lambda x : True if (x > 10 and x < 20) else False
5
lambda x: True if x % 2 == 0 else False
0
func = lambda element: (expression and DoSomething) or DoSomethingIfExpressionIsFalse
0

New to Communities?

Join the community