Suppose I have the following line of code:
print("valley" in "hillside" == False)
Since the precedence of in
and ==
is equivalent in Python, I expected the operations to be performed from left to right, producing True
as the output.
However, in actuality, when I run this line of code, I get False
.
I have noticed that adding brackets around "valley" in "hillside"
results in True
as the output but I don't seem to understand why it's necessary in the first place...