+ 20
Why this is Falseāļøš¤
lst = ["a", True] print("a" in lst in lst)
6 Answers
+ 15
It seems to work the same as :
print('a' in lst and lst in lst) āļø
+ 4
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")