c = 'l'
s1 = 'hello'
s2 = 'hello'
print(c in s1 == s2)
This results in True, but,
c = 'z'
s1 = 'hello'
s2 = 'hello'
print(c in s1 == s2)
and
c = 'l'
s1 = 'hello'
s2 = 'hel'
print(c in s1 == s2)
They result in False, i.e., if any one of the statements is False the entire expression becomes False.
Hence, both the statements are evaluated. How does this work?
If the first one was evaluated first, c in s1
→ True, it would result in True == s2
, i.e. False.
If it was from right to left, s1 == s2
→ True, it would result in c in True
, i.e. False.
Can someone please explain this?