I was learning about lambda functions, and saw this example. I cannot understand how, 'odd', or 'even' is selected.
print((lambda x: (x % 2 and 'odd' or 'even'))(3))
returns odd
print((lambda x: (x % 2 and 'odd' or 'even'))(4))
returns even
I was learning about lambda functions, and saw this example. I cannot understand how, 'odd', or 'even' is selected.
print((lambda x: (x % 2 and 'odd' or 'even'))(3))
returns odd
print((lambda x: (x % 2 and 'odd' or 'even'))(4))
returns even