+ 2

but why, not(print(4 not in nums)) is True. the first not should make it False. I thought not works like this too.

here nums=[3,5,6] say,

12th Sep 2016, 12:44 PM
Abhishek Chauhan
Abhishek Chauhan - avatar
4 Réponses
+ 3
You evaluate the returning value of print(). print() always returns None, and None evaluates to False, so `not None` evaluates to True (try this: `if not None: print('x')`). Everything works as expected. By the way, not is not a command, it's an operator. And print() is a function (there's a difference).
12th Sep 2016, 3:50 PM
trueneu
trueneu - avatar
0
so not command don't work outside print command like this.
12th Sep 2016, 12:47 PM
Abhishek Chauhan
Abhishek Chauhan - avatar
0
yes
13th Sep 2016, 6:22 AM
Kartik Patodi
Kartik Patodi - avatar
0
thanks trueneu
16th Sep 2016, 7:20 AM
Abhishek Chauhan
Abhishek Chauhan - avatar