0
Why the output of the second print function is True although not operator is used ?
x = 5 a = print(x > 0 or x < 3) print(not a)
3 ответов
+ 6
ok, now i understood, this is happening cuz.. you put the expression in the print statement.
If you had done the following:
x = 5
a = x > 0 or x < 3
print(x) #True
print(not x) #False
then u would get the expected output
+ 1
@Cool Codin Sr mate. The third line of code or the second print function outputs True, not False. This is where I'm confusing because I used not operator, the output is supposed to be False, but it's True :)
0
Well...you can put Boolean expression in the print function. For example, print(5==5) or print(x>3) with x = 4, etc. The thing is print(a) and the output will be None. Subsequently, you use not operator, the output is False. I'm curious why this happens.