+14

Why this is False⁉️🤔

lst = ["a", True] print("a" in lst in lst)

8/30/2019 9:56:16 PM

Janusz Bujak 🇵🇱

6 Answers

New Answer

+14

It seems to work the same as : print('a' in lst and lst in lst) ⁉️

+3

Janusz Bujak 🇵🇱 this is what youre after print(("a" in lst)in lst) “(“a” in lst)” evaluates True FIRST then tests for “True in lst” which returns True.

+2

Use : print("a" in lst)

+1

Not sure if this help to explain but .. lst = [1, True, 'a'] lst2 = [[1, True, 'a'], [1, 2], [3, 4], [5, 6]] print('a' in lst in lst2) ### returns True

+1

That's exactly how it works, Janusz Bujak 🇵🇱.

0

because,you used in print"a" which is an element. But you should use in print(1st,"in 1st in list")