What difference between the following code ? | Sololearn: Learn to code for FREE!

+5

What difference between the following code ?

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

8/7/2022 5:09:12 PM

E ~ J

4 Answers

New Answer

+1

Results same.. Not 'iam a robot' 'Iam not a robot'

+3

(not 4 in list) and (4 not in list) same ?

+3

Now, I understand it. Thank you

+1

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.