Computer Science
int('a') produces error but following expression having int('a') in it, does not return error. Why?
len('a') + 2 or int('a')
Answer
The or operator tests the second operand only if the first operand is false otherwise it ignores it. In the expression, the first operand of or operator is len('a') + 2. It evaluates to 3 and as it is a non-zero value hence it is True for or operator. As first operand of or operator is True so it doesn't evaluate its second argument int('a') and no error is returned.