I am new in python and need help with short code snippet below:
x=5
print(not x<=6)
Why the result is False? I think in the next way: not x is False, 0. Then 0 is less than 6. It's True.
I am new in python and need help with short code snippet below:
x=5
print(not x<=6)
Why the result is False? I think in the next way: not x is False, 0. Then 0 is less than 6. It's True.
You have set x equal to 5. This means that when you logically check if x is less than or equal to 6, it will be True. Since you have not there, it cancels the True to make it False, therefore printing False.
I think you may have got your operator precedence mixed up:
<, <=, >, >=, !=, == all take precedence over not