I came across a Python Challenge question with a variable declaration I didn't understand. It was asking for the output of this code.
a = "abcd"
b = "abc"
func = (lambda s:s[1:]) or (lambda s:s[:-1])
print(func(b))
I pretty much ignored the second lambda and got the correct answer which was:
"bc"
My questions are, what is the practical use of having an "or" during variable assignment between lambda functions? And how would I access the second lambda in an "or" statement? What would be an example of the second lambda function being invoked?
Note: My question has been marked as a duplicate. The other question and answer provided great information and supplementary knowledge related to my topic. However, that question was dealing with return values and general statements. I think my question is different in that it deals with variable assignment rather than return values, and the application of "or" to functions, which I don't see covered in the other question. I would still like clarification on the concept of truthiness or falsey values applied to a lambda function.