Interpretation of chained Booleans

Viewed 32

I was answering another question and came across something similar to this:

n = 1
l = [1, 2, 3]

print(n in l is True)
# False

# same for:
print(n in l == True)
# False

When I looked at it, I intuitively knew what was wrong, but after trying to explain the issue I noticed I don't actually understand the problem here.

It might be a silly question, but why does this return False?

Edit: I know the is True is not required and I could solve it by using brackets around n in l

0 Answers
Related