+ 7

What difference between the following code ?

list = [1, 2, 3, 4, 5] print(not 4 in list) # and print(4 not in list)

7th Aug 2022, 5:09 PM
Scientist
Scientist - avatar
4 Answers
+ 2
Results same.. Not 'iam a robot' 'Iam not a robot'
7th Aug 2022, 5:49 PM
Jayakrishna🇮🇳
Jayakrishna🇮🇳 - avatar
+ 3
(not 4 in list) and (4 not in list) same ?
7th Aug 2022, 5:38 PM
Scientist
Scientist - avatar
+ 3
Now, I understand it. Thank you
7th Aug 2022, 5:51 PM
Scientist
Scientist - avatar
+ 2
Just read as the phrases saying.. not 4 in list => 4 in list : true, then applies not as not True => false 4 not in list => False # single instruction.
7th Aug 2022, 5:22 PM
Jayakrishna🇮🇳
Jayakrishna🇮🇳 - avatar