Back
I see this code in my python reference guide, but no description.
I am asked a question like what does this do:
print 2 and 1-2 !=3
It returns True, but why?
In, Python != means "not equal to" and is a logical comparison. Break down the logical expression here:
2 and 1 - 2 != 3 2 and -1 != 3 2 and True True
2 and 1 - 2 != 3
2 and -1 != 3
2 and True
True
To know more about this you can have a look at the following video tutorial:-
31k questions
32.8k answers
501 comments
693 users